Re: Counter problems!

From: Date: Wed, 29 Jan 2003 13:34:58 +0000
Subject: Re: Counter problems!
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-18175@lists.php.net to get a copy of this message
You could check the IP adress of the visitor. If it has not changed the the visitor is the same. Last IP adress in the counter file? Jochem Radovan Radic wrote:
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


« previous php.windows (#18175) next »