Hello everybody
I have a simple countlog script on my site but it now happened twice that the counter reset/change itself. It was for example 37 000 something and then just change to 300 something without any reason.
<?php
/* counter */
$datei = fopen("countlog.txt","r"); //opens countlog.txt to read
$count = fgets($datei,1000);
fclose($datei);
$count=$count + 1 ;
echo "<font color=#FFFFFF><b>$count </b>Page views since 1/01/2006</font>";
$datei = fopen("countlog.txt","w"); // opens to write and deletes the old count
fwrite($datei, $count);
fclose($datei);
?>
Anyone know why this happens and have a workaround or change to the code above please?
Many thanks