Jump to content

Text Files Hit Counter Issue/Question


phpQuestioner

Recommended Posts

I have a script that I am using for text file based hit counter. I have been noticing that my the original hit count, in my text file has been fluctuating from the original amount to a very low amount. What is causing this and is there a good way to fix it?

 

<?php

$fp = fopen ('textfilesname.txt', 'r');
$now = fgets ($fp);
fclose ($fp);
if (empty ($_COOKIE['cookiesname']))
{	
$fp = fopen ('textfilesname.txt', 'w');	
$now = $now + 1;	
fwrite ($fp, $now);	
setcookie ('cookiesname', 1, time()+315360000);
fclose($fp);
}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/71088-text-files-hit-counter-issuequestion/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.