У меня есть скрипт подсчета посетителей на моем Веб-сайт.
Он работал хорошо до полудня (ITC), но теперь он не работает, также все файлы отсчетов теперь не имеют никакого текста, даже одного символа.
Мои коды:
<?php
if (file_exists('date.txt')) {
date_default_timezone_set('Asia/Calcutta');
$cdatel = date('Y-m-d', time());
$dthandle = fopen("date.txt", "r"); //reads date
$date = fread($dthandle,filesize("date.txt"));
fclose ($dthandle);
$tthandle = fopen("total.txt", "r"); //reads total count
$ttcounter = fread($tthandle,filesize("total.txt"));
fclose ($tthandle);
$ttcounter++; //+1 for new count in total
$ttl = $ttcounter;
$tthandle = fopen("total.txt", "w" ); //write for total count
fwrite($tthandle,$ttcounter);
fclose ($tthandle);
if($cdatel == $date){ //checks whether date in file is same as current date
$handle = fopen("today.txt", "r"); //reads todays count
$counter = fread($handle,filesize("today.txt"));
fclose ($handle);
$yhandle = fopen("yesterday.txt", "r"); //reads todays count
$yv = fread($yhandle,filesize("yesterday.txt"));
fclose ($yhandle);
$counter++; //+1 for new count in todays
$tdy = $counter;
$handle = fopen("today.txt", "w" ); //write for todays count
fwrite($handle,$counter);
fclose ($handle);
}
else{
$ttyhandle = fopen("date.txt", "w" );
fwrite($ttyhandle,$cdatel);
fclose ($ttyhandle);
$ttyhandle = fopen("today.txt", "r");
$tdycounter = fread($ttyhandle,filesize("today.txt"));
fclose ($ttyhandle);
$zero = "0";
$tzhandle = fopen("today.txt", "w" );
fwrite($tzhandle,$zero);
fclose ($tzhandle);
$ttyhandle = fopen("yesterday.txt", "w" );
fwrite($ttyhandle,$tdycounter);
fclose ($ttyhandle);
?>
<meta http-equiv="refresh" content="0; ./sitemap-generator.php">
<?php
}
}
?>
Задача ещё не решена.
Других решений пока нет …