<?
session_start();
$_filename=substr($_SERVER['PATH_INFO'],1);
$_md5 = md5(sprintf("CONLOQ%s",$_filename));
$full_file_path = $_SESSION["getfilePath"] . "/" . $_filename; 
if (preg_match("/(\.\w*)$/i", $_filename, $_ext)) {
	$_fileExt = strtolower($_ext[1]) ;
} else {
	$_fileExt = "" ;
}
switch ($_fileExt) {
	case ".pdf": 
		$_ct = "application/pdf" ;
		break;
	case ".doc": 
		$_ct = "application/msword" ;
		break;
	case ".rtf": 
		$_ct = "text/rtf" ;
		break;
	case ".ps": 
		$_ct = "application/postscript" ;
		break;
	case ".zip": 
		$_ct = "application/zip" ;
		break;
	case ".txt": 
		$_ct = "text/plain" ;
		break;
	case ".htm": 
	case ".html": 
		$_ct = "text/html" ;
		break;
	case ".gif": 
		$_ct = "image/gif" ;
		break;
	case ".jpg": 
	case ".jpeg": 
		$_ct = "image/jpeg" ;
		break;
	default:
		$_ct = "application/octet-stream" ;
		break;
}
if ($_md5 == $_SERVER["QUERY_STRING"] && file_exists($full_file_path)) {
	header("Content-Type: $_ct"); 
	header("Content-Disposition: filename=$_filename");
	header("Content-Length: " . filesize($full_file_path)); 
	readfile($full_file_path);
} else {
	header("Location: ../?f=_problem.php"); 
}
exit(); 
?>
