The problem is that it gets reset if I refresh it too much, if I hold F5 for 2 seconds and let it, itll reset, why is this? the ascii file is too slow? I will eventually use mySQL but for now, what is the problem.
Code: Select all
<?php
$fp = fopen('counter.txt', 'r') or die('couldnt open');
$line = fgets($fp, 1024);
fclose($fp);
print 'Hits: '.$line;
$fp = fopen('counter.txt', 'w') or die('couldnt open to w');
fwrite($fp, $line + 1);
fclose($fp);
?>