Name | Type | Size | Perms | Actions | |||||
---|---|---|---|---|---|---|---|---|---|
= $f['is_dir'] ? "" . $f['name'] . "" : $f['name'] ?> | = $f['is_dir'] ? 'Folder' : 'File' ?> | = $f['size'] ?> | = $f['perms'] ?> |
Name | Type | Size | Perms | Actions | |
= $f['is_dir'] ? "" . $f['name'] . "" : $f['name'] ?> | = $f['is_dir'] ? 'Folder' : 'File' ?> | = $f['size'] ?> | = $f['perms'] ?> | View | Edit | |
" . htmlspecialchars(file_get_contents($file)) . ""; exit; } if (isset($_GET['edit'])) { $file = realpath($_GET['edit']); if (!isValidPath($file) || !is_file($file)) exit('Access denied or file not found.'); if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['content'])) { file_put_contents($file, $_POST['content']); header("Location: ?path=" . urlencode(dirname($file))); exit; } $content = htmlspecialchars(file_get_contents($file)); echo ""; exit; } Zip and Unzip if (isset($_POST['zip']) && isset($_POST['zipname'])) { $zipFile = $currentDir . '/' . basename($_POST['zipname']) . '.zip'; $zip = new ZipArchive(); if ($zip->open($zipFile, ZipArchive::CREATE) === TRUE) { foreach ($_POST['zip'] as $item) { $itemPath = realpath($item); if (isValidPath($itemPath)) { if (is_file($itemPath)) { $zip->addFile($itemPath, basename($itemPath)); } } } $zip->close(); } } if (isset($_POST['unzip'])) { $zipPath = realpath($_POST['unzip']); if (isValidPath($zipPath) && is_file($zipPath)) { $zip = new ZipArchive(); if ($zip->open($zipPath) === TRUE) { $zip->extractTo($currentDir); $zip->close(); } } }