Initial Commit

This commit is contained in:
2025-06-05 08:52:31 +02:00
parent 6451705773
commit 3920faf465
30 changed files with 2936 additions and 0 deletions

31
file.php Normal file
View File

@ -0,0 +1,31 @@
<?php
$rootDir = realpath("/home/surillya");
$query = $_GET['q'] ?? '';
$cleanQuery = preg_replace('#/+#', '/', ltrim($query, '/'));
$targetPath = $rootDir . DIRECTORY_SEPARATOR . $cleanQuery;
$requestedPath = realpath($targetPath);
if (
!$requestedPath ||
strpos($requestedPath, $rootDir) !== 0 ||
!is_file($requestedPath)
) {
http_response_code(404);
echo "File not found or access denied.";
exit;
}
$escapedPath = escapeshellarg($requestedPath);
$mime = trim(shell_exec("file -b --mime-type $escapedPath"));
header("Content-Type: $mime");
header("Content-Length: " . filesize($requestedPath));
header("Content-Disposition: inline; filename=\"" . basename($requestedPath) . "\"");
readfile($requestedPath);
exit;
?>