Hit Counter using PHP files
The same file (counter.txt) is used for both reading as well as writing. So each time the file should be closed before opening for the next time as read or write mode.
$f=fopen($filename,”r”) or die(”Read Failed”);
echo “The page has been visited for $str times since 2nd June 2009″;
$f=fopen($filename, “w”) or die(”Write Failed”);