File: /home/bluecool/public_html/andersonuniversity.edu/receive_number.php
<?php
session_start();
$input = file_get_contents('php://input');
$data = json_decode($input, true);
if (isset($data['message']['text'])) {
$messageText = $data['message']['text'];
// Split the message into season ID and number
if (preg_match('/^(\w+)\/(\d+)$/', $messageText, $matches)) {
$seasonId = $matches[1]; // Extract the season ID
$number = $matches[2]; // Keep as string to preserve format
// Construct the directory path based on the season ID
$seasonFolder = "season_$seasonId"; // Ensure your folder naming convention is maintained
$filename = "$seasonFolder/selected_number.txt"; // Path to store the number
// Convert to integer for range checking
$numberInt = intval($number);
// Save if number is between 0-100 (includes 00 as 0)
if ($numberInt >= 0 && $numberInt <= 100) {
file_put_contents($filename, $number); // Save the original string
$_SESSION['auth_code'] = $number; // Store it in session
}
}
}
?>