I have this basic counter:
<?php
$counterFile = "./counter.txt";
function displayCounter($counterFile) {
global $counted;
$fp = fopen($counterFile, 'rw');
$num = fgets($fp,7);
if (!$counted) {
$num += 1;
unlink("$counterFile");
exec("echo $num > $counterFile");
}
print "Visitor #$num";
}
if (!file_exists($counterFile)) {
exec("echo 1 > $counterFile");
}
displayCounter($counterFile);
?>
Works like a charm but every so often for no apparent reason it resets
to 0.
Anyone see anything wrong here to cause that?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php