File size: 754B
<?php
$time = time();
$filtime = filemtime(BASEDIR . "local/datatmp/golos.dat");
$filtime = $filtime + (3600*24);
if ($time > $filtime){
$totalfile = counter_string(BASEDIR.'local/datavotes/golos.dat');
$fp = fopen(BASEDIR."local/datatmp/golos.dat","a+");
flock ($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,$totalfile);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod ($fp, 0666);
chmod (BASEDIR."local/datatmp/golos.dat", 0666);}
$linput = file_get_contents(BASEDIR . "local/datatmp/golos.dat");
$totalfile = counter_string(BASEDIR.'local/datavotes/golos.dat');
$totalnewfile = $totalfile-$linput;
$ltext = $totalnewfile;
if ($ltext > 0){
echo ' ['.$totalfile.'<font color=red>+'.$ltext.'</font>]<br>';
}else{
echo ' ['.$totalfile.']<br>';}
?>