Размер файла: 1.89Kb
<?php
$time = time();
$filtime = filemtime(BASEDIR . "local/datatmp/forumthem.dat");
$filtime = filemtime(BASEDIR . "local/datatmp/forumpost.dat");
$filtime = $filtime + (3600*24);
if ($time > $filtime){
$count_lines1 = file(BASEDIR . "local/dataforum/mainforum.dat");
$count1 = count($count_lines1);
$nf1 = "0";
$af1 = "-1";
$uf1 = $count1-1;
$fids1 = "0";
$alltem1 = "0";
$allmsg1 = "0";
do{
$af1++;
$dtf1 = explode("|", $count_lines1[$af1]);
$alltem1 = $alltem1 + $dtf1[4];
$allmsg1 = $allmsg1 + $dtf1[5];
} while ($af1 < $uf1);
$fp1 = fopen(BASEDIR."local/datatmp/forumthem.dat","a+");
flock ($fp1,LOCK_EX);
ftruncate($fp1,0);
fputs($fp1,$alltem1);
fflush ($fp1);
flock ($fp1,LOCK_UN);
fclose($fp1);
chmod ($fp1, 0666);
chmod (BASEDIR."local/datatmp/forumthem.dat", 0666);
$fp2 = fopen(BASEDIR."local/datatmp/forumpost.dat","a+");
flock ($fp2,LOCK_EX);
ftruncate($fp2,0);
fputs($fp2,$allmsg1);
fflush ($fp2);
flock ($fp2,LOCK_UN);
fclose($fp2);
chmod ($fp2, 0666);
chmod (BASEDIR."local/datatmp/forumpost.dat", 0666);}
$them = file_get_contents(BASEDIR . "local/datatmp/forumthem.dat");
$post = file_get_contents(BASEDIR . "local/datatmp/forumpost.dat");
$count_lines = file(BASEDIR . "local/dataforum/mainforum.dat");
$count = count($count_lines);
$nf = "0";
$af = "-1";
$uf = $count-1;
$fids = "0";
$alltem = "0";
$allmsg = "0";
do{
$af++;
$dtf = explode("|", $count_lines[$af]);
$alltem = $alltem + $dtf[4];
$allmsg = $allmsg + $dtf[5];
} while ($af < $uf);
$totalnewthem= $alltem-$them;
$ltext1 = $totalnewthem;
$totalnewpost = $allmsg-$post;
$ltext2 = $totalnewpost;
if ($ltext1 > 0){
echo' ('.$alltem.'<font color="#FF0000">+'.$ltext1.'</font>/';
}else{
echo' ('.$alltem.'/';}
if ($ltext2 > 0){
echo $allmsg.'<font color="#FF0000">+'.$ltext2.'</font>/';
}else{
echo $allmsg.'/';}
include_once BASEDIR."pages/forumchet.php";
echo')<br>';
?>