diff options
author | Minteck <contact@minteck.org> | 2022-12-18 22:14:36 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-12-18 22:14:36 +0100 |
commit | e9002254c55165ebb0cd0eae7a2e83c993f4d882 (patch) | |
tree | 7a876766dd9c217129b0e219215d1dfcaad142c8 /uploads.php | |
download | delta-e9002254c55165ebb0cd0eae7a2e83c993f4d882.tar.gz delta-e9002254c55165ebb0cd0eae7a2e83c993f4d882.tar.bz2 delta-e9002254c55165ebb0cd0eae7a2e83c993f4d882.zip |
Initial commit
Diffstat (limited to 'uploads.php')
-rw-r--r-- | uploads.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/uploads.php b/uploads.php new file mode 100644 index 0000000..b0673d9 --- /dev/null +++ b/uploads.php @@ -0,0 +1,15 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; + +if (!isset($_GET['_'])) die(); + +$name = preg_replace("/[\/]/m", "", $_GET['_']); + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name) && is_file($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name)) { + header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name)); + header("Content-Length: " . filesize($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name)); + readfile($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name); +} else { + die("Not found: " . $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name); +}
\ No newline at end of file |