header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
include("var.php");
$DIR=$_GET["DIR"];
$lista="
\">
";
if ($DIR=="") { echo "Ures konyvtar"; exit; }
if (preg_match("|\.\.|",$DIR)) { echo "Ejnye!"; exit; }
if (!is_dir($ROOT.$DIR)) { echo "Nem konyvtar"; exit; }
$filez=array();
$dirz=array();
$nofile=1;
if ($dh = opendir($ROOT.$DIR)) {
while (($file = readdir($dh)) !== false) {
if ($file == "." || $file == "..") { continue; }
$filename=$ROOT.$DIR."/".$file;
if (is_file($filename)) {
if (preg_match("|.*/([^/]*)\.([^\.]*)|",$filename,$matches)) {
$stat = stat($filename);
$filez["$filename"] = $stat['mtime'].$filename; // Modositas datuma elore, hogy aszerint rendezzen, majd a filenev, hogy tuti unique maradjon
}
}
if (is_dir($filename)) {
$stat = stat($filename);
$dirz["$file"] = $stat['mtime'].$filename; // Modositas datuma elore, hogy aszerint rendezzen, majd a filenev, hogy tuti unique maradjon
}
}
closedir($dh);
}
arsort($filez); // Rendez
arsort($dirz); // Rendez
foreach($dirz as $file => $nemfontos) {
$lista.="".$file."
\n";
}
foreach($filez as $filename => $nemfontos) {
preg_match("|.*/([^/]*)\.([^\.]*)|",$filename,$matches);
$felirat=$matches[1]; $kiterjesztes=strtolower($matches[2]);
if ($FILEMD==md5($filename)) {
$nofile=0;
header('Content-Description: File Transfer');
header('Content-Type: '.(strlen($mime[$kiterjesztes]) ? $mime[$kiterjesztes] : "application/octet-stream"));
header('Content-Disposition: attachment; filename= =?'.$TARGET_CODE.'?B?'.base64_encode($felirat.".".$kiterjesztes).'?=');
header('Content-Transfer-Encoding: binary');
//header('Expires: 0');
//header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($filename));
ob_clean();
flush();
readfile($filename);
exit;
} else {
$lista.="".$felirat."
\n";
}
}
$lista.="";
if ($nofile) {
header('Content-Type: text/html; charset=$TARGET_CODE');
echo $lista;
}
?>