Counter problems!
| From: | Radovan Radic | Date: | Wed, 29 Jan 2003 13:34:14 +0000 |
| Subject: | Counter problems! | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-18174@lists.php.net to get a copy of this message | ||
Hi
I want to add simple counter on my index.php page.
counter.php:
<?
if (!session_is_registered("counter"))
{
$fp=fopen("counter.txt","r");
$counter=fread($fp);
fclose($fp);
$counter++;
session_register("counter");
}
print "Visited: $counter<BR>";
?>
index.php
<?
session_start();
print "Simple page<BR>";
include("counter.php");
?>
This should work, but when someone refreshes index.php page, counter is
increased! How can i stop it?
Thx,
Radovan