<?php
// Only allow deletion of files in the 'dump' directory
$allowedDir = realpath(__DIR__ . '/dump');

// Sanitize and validate input
$filename = basename($_GET['fl'] ?? '');
$filepath = realpath($allowedDir . DIRECTORY_SEPARATOR . $filename);

// Validate that the file is actually inside the allowed directory
if ($filepath && str_starts_with($filepath, $allowedDir) && is_file($filepath)) {
    unlink($filepath);
}

// Redirect back
header("Location: restore.php");
exit;
?>
