Просмотр файла public_html/template/library.php

Размер файла: 1.87Kb
<?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/library.dat");
$lib_count=file_get_contents(BASEDIR."local/datatmp/library.dat");
$lib_count=strtok($lib_count,'/');

$filtime=$filtime+(3600*$config_librarycache);

if($sitetime>$filtime || $lib_count<50){

$dir = opendir (BASEDIR."library"); 
while ($file = readdir ($dir)) {
if (is_dir(BASEDIR."library/$file")) {
if($file=="."||$file=="..") continue;
$libdir_array[]=$file;
}}  
closedir ($dir);  

$totaldir = count($libdir_array); 
$libtime_array=array();

for ($i = 0; $i < $totaldir; $i++){
$ldir = opendir (BASEDIR."library/$libdir_array[$i]");
while ($file = readdir ($ldir)) {
if (ereg("\.txt$", $file)){
	
$libfile_array[]=$file;

$filetime=filemtime(BASEDIR."library/$libdir_array[$i]/$file")+(3600*24*5);
if($filetime>$sitetime){	
$libtime_array[]=$file;

}}}
closedir ($ldir);
}

$totalfile = count($libfile_array); 
$totalnewfile = count($libtime_array); 

if($totalnewfile>0){	
$ltext=(int)$totalfile.'/+'.(int)$totalnewfile; 
}else{
$ltext =(int)$totalfile;
}


$fp = fopen(BASEDIR."local/datatmp/library.dat","a+");
flock ($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,$ltext);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
@chmod ($fp, 0666); 
@chmod (BASEDIR."local/datatmp/library.dat", 0666); 
}


$linput = file_get_contents(BASEDIR."local/datatmp/library.dat"); 
echo ' ('.$linput.')<br>';
	
?>