Hi there, I'm new to PHP (usually coding in ASP) and this is a problem that should be VERY straight forward but I'm having weird problems. Basically I want a really basic counter that just increments a number in a text file.
I am using the following code:
$filepath = "../cgi-bin/counter.log
$fp = fopen($filepath,"r");
$count = fread($fp, filesize($filepath));
fclose($fp);
$count++;
$fp = fopen($filepath,"w");
$fout = fwrite($fp, $count);
fclose($fp);
Ok, this works fine most of the time, however, every so often I'll come back and the counter file will loose some of the digits and also have a couple of non-visible characters attached.
Am I right in assuming this script should work, or is there something I'm missing.
Thanks in advance.
Dan
www.pupius.net