I have several pages that all use the following counter code. The problem is that it seems to keep resetting back to zero (or some other very low number, I don’t really know for sure). I have set it to several large numbers like 2 million and it works fine for a while then I go back and it shows something like 243 or whatever. It does not happen right away, sometimes it is daily, some weekly, others monthly.
[code=php]$fp=fopen(“sheep_counter.txt”,”r”);
//Read the previous count
$count=fgets($fp,1024);
//close the file.
fclose($fp);
$fw=fopen(“sheep_counter.txt”,”w”);
//Increment the counter
$cnew=$count+1;
//write the counter back to the log file ie., sheep_counter.txt
$countnew=fputs($fw,$count+1);
//Display VISITOR NUMBER
echo “<br> <p align=center> You are the $cnew Visitor to This site”;
fclose($fw);