35 lines
1.0 KiB
PHP
Executable File
35 lines
1.0 KiB
PHP
Executable File
<?php
|
|
require_once("../config.inc.php");
|
|
if($_SESSION["global_username"] == ''){
|
|
echo"<script type='text/javascript'>window.top.location.href = \"index.php\";</script>";
|
|
exit;
|
|
}
|
|
$file = urldecode($_GET["file"]);
|
|
#$file = str_replace('%28', '(', $file);
|
|
#$file = str_replace('%29', ')', $file);
|
|
#$file = str_replace('%2C', ',', $file);
|
|
#$file = str_replace('%3B', ';', $file);
|
|
#$file = str_replace('%3B', ';', $file);
|
|
#$file = str_replace('%E2%80%93', '–', $file);
|
|
|
|
|
|
if (file_exists($file)) {
|
|
header("Content-Type: application/octet-stream");
|
|
header("Content-Disposition: attachment; filename=" . urlencode(basename($file)));
|
|
header("Content-Type: application/download");
|
|
header("Content-Description: File Transfer");
|
|
header("Content-Length: " . filesize($file));
|
|
|
|
flush(); // This doesn't really matter.
|
|
|
|
$fp = fopen($file, "r");
|
|
while (!feof($fp)) {
|
|
echo fread($fp, 65536);
|
|
flush(); // This is essential for large downloads
|
|
}
|
|
|
|
fclose($fp);
|
|
}else{
|
|
echo "Datei nicht gefunden";
|
|
}
|
|
?>
|