File size: 2.52Kb
<?php
#-----------------------------------------------------#
# ********* WAP-MOTORS ********* #
# Made by : VANTUZ #
# E-mail : [email protected] #
# Site : http://pizdec.ru #
# WAP-Site : http://visavi.net #
# ICQ : 36-44-66 #
# Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#
//------------------------------ НОВАЯ ФУНКЦИЯ КЕШИРОВАНИЯ ------------------------------//
$filtime=filemtime(BASEDIR."local/datatmp/down.dat");
$down_count=(int)file_get_contents(BASEDIR."local/datatmp/down.dat");
$filtime=$filtime+3600; //1-часовое индексирование
$ttime=time();
if($ttime>=$filtime || $down_count<50){
$dir = opendir (BASEDIR."download");
while ($file = readdir ($dir))
{if (( $file != ".") && ($file != "..") && ($file != ".htaccess") && ($file != "index.php") && ($file != "top.php") && ($file != "down.php") && ($file != "new.php")&& ($file != "zip.php")&& ($file != "search.php"))
{$a[]=$file;}}
closedir ($dir);
$total = count($a);
for ($i = 0; $i < $total; $i++){
$dir = opendir (BASEDIR."download/$a[$i]");
while ($file = readdir ($dir))
{if (( $file != ".") && ($file != "..") && ($file != ".htaccess") && ($file != "index.php") && ($file != "name.dat") && !ereg (".txt$", "$file")&& !ereg (".JPG$", "$file")&& !ereg (".GIF$", "$file"))
{$a[]=$file;}}
closedir ($dir);
}
$tot = count($a);
$to=round($tot-$total);
for ($i2 = 0; $i2 < $total; $i2++){
$dircc = opendir (BASEDIR."download/$a[$i2]");
while ($filecc = readdir ($dircc))
{
$filtime=filemtime (BASEDIR."download/$a[$i2]/$filecc");
$filtime=$filtime+(3600*24*5); //Сколько файл считать новым сейчас уст. на 5 суток
$ttime=time();
if($filtime>=$ttime){
if (ereg(".txt$", "$filecc"))
{
$cc[]=$filecc; }}}
closedir ($dircc);
}
$to2 = count($cc);
if($to2>0){
$dtext=(int)$to.'/+'.(int)$to2;
}else{
$dtext =(int)$to;
}
$fp = fopen(BASEDIR."local/datatmp/down.dat","a+");
flock ($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,$dtext);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod ($fp, 0777);
chmod (BASEDIR."local/datatmp/down.dat", 0777);
}
$dinput = file(BASEDIR."local/datatmp/down.dat");
echo ' ('.$dinput[0].')<br>';
?>