<?
// Turn off default error reporting
error_reporting(0);
//
// include configuration & functions file & error handling
if ($cfg['httpd_mode'] != 'webcp') {
$tmp = "config.inc.php";
include($tmp);
$tmp = "functions.inc.phps";
include($tmp);
}
if ($tf = fopen($filelocation, "r")) {
// Date in the past
send_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
send_header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
send_header("Cache-Control: no-store, no-cache, must-revalidate");
send_header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
send_header("Pragma: no-cache");
// We'll be outputting a log
send_header('Content-type: '.$filetype);
// It will be called downloaded.pdf
send_header('Content-Disposition: attachment; filename="'.$filename.'"');
while (!feof($tf)) {
echo fread($tf, 1024);
}
if ($removefile == "true") {
unlink($filelocation);
}
} else {
echo "error";
}
?>