| Current Path : /var/www/cesa.co.za/ |
| Current File : /var/www/cesa.co.za/download-file.php |
<?php
session_start();
$file=$_REQUEST["path"].'/'.$_REQUEST["filename"];
$sfileext = pathinfo($file, PATHINFO_EXTENSION);
$bIsCCEAdmin = (isset($_SESSION["CESA_CCE_status"])) && ($_SESSION["CESA_CCE_status"] == 'login');
$bIsCCEConvenor = (isset($_SESSION["CESA_Convenors_status"])) && ($_SESSION["CESA_Convenors_status"] == 'login');
$bIsCCECCMStudent = (isset($_SESSION["StudentID"])) && !empty($_SESSION["StudentID"]);
$bIsCCMAdmin = (isset($_SESSION["CESA_CCM_status"])) && ($_SESSION["CESA_CCM_status"] == 'login');
if ($bIsCCEAdmin || $bIsCCEConvenor || $bIsCCECCMStudent || $bIsCCMAdmin) {
header('Content-Disposition: attachment; filename='.urlencode($_REQUEST["filename"]));
header("Content-Type: application/".$sfileext);
header("Content-Length: " . filesize($file));
readfile($file);
}
else
{
echo "This information is only available to registered users.<br /><br />Please log in to view this information.";
}
?>