Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64
Your IP : 18.117.232.108
<?
//Load the standard includes
include("../includes/mysql_connect.php");
//Check if the content exists already in the nav cache
if(is_file("../../navcache" . $currentpath)){
//Get this file out of the DB
$files = mysql_query($sql = "SELECT * FROM navigator_files WHERE CONCAT(CONCAT(path, '/'), filename) = '" . mysql_escape_string(urldecode($_GET[currentpath])) . "'", $mysql_link);
if(mysql_num_rows($files) > 0){
$filedata = mysql_fetch_assoc($files);
header("Content-type: " . $filedata[contenttype]);
if($_GET[content] == "save"){
header("Content-Disposition: attachment; filename=" . $filedata[filename]);
}
readfile("../../navcache" . $currentpath);
}else{
header("Content-type: text/plain");
echo "Incorrect specifications";
}
}else{
//Get this file out of the DB
$files = mysql_query($sql = "SELECT * FROM navigator_files WHERE CONCAT(CONCAT(path, '/'), filename) = '" . mysql_escape_string(urldecode($_GET[currentpath])) . "'", $mysql_link);
if(mysql_num_rows($files) > 0){
$filedata = mysql_fetch_assoc($files);
//Parse the path and build it if not existent
$outputpath_expl = explode("/", "../../navcache" . $currentpath);
$basepath = "../../navcache";
for($i=3; $i<count($outputpath_expl)-1; $i++){
if(!is_dir($basepath . "/" . $outputpath_expl[$i])){
mkdir($basepath . "/" . $outputpath_expl[$i], 0775);
}
$basepath .= "/" . $outputpath_expl[$i];
}
//Output the file to the system
$fp = fopen("../../navcache" . $currentpath, "w");
fwrite($fp, $filedata[data]);
fclose($fp);
header("Content-type: " . $filedata[contenttype]);
if($_GET[content] == "save"){
header("Content-Disposition: attachment; filename=" . $filedata[filename]);
}
readfile("../../navcache" . $currentpath);
}else{
header("Content-type: text/plain");
echo "Incorrect specifications";
}
}
//Load the standard includes footers
include("../includes/mysql_cleanup.php");
?>
|