La funzione l'ho capita, ma non capisco come far passare il percorso dove si trova il file!!
Codice PHP:
<?php
include_once("../include/config.php");
include_once("../include/auth.lib.php");
list($status, $user) = auth_get_status();
function readfileheader($file) {
if($file) {
header("Expires: Mon, 12 Jul 1976 06:20:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file).'"');
readfile($file);
}
}
switch($status){
case AUTH_LOGGED:
readfileheader($_GET['file']);
break;
case AUTH_NOT_LOGGED:
echo 'You must be logged in to do that';
header("Refresh: 3;URL=../memberslogin.php");
break;
}
?>