RE: [PHP-WIN] Re: Counter problems!
| From: | Jill dot Ramonsky at Aculab dot com | Date: | Thu, 30 Jan 2003 13:07:53 +0000 |
| Subject: | RE: [PHP-WIN] Re: Counter problems! | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-18226@lists.php.net to get a copy of this message | ||
For reasons of scope, you may need to first use $count outside the braces.
This would give you...
<?
session_start();
$count = 0;
if ( ! isset($_SESSION['been_here_before']) )
{
$_SESSION['been_here_before']=TRUE;
$fp=fopen("./counter.txt","r");
$count=fread($fp,5);
fclose($fp);
++$count;
$fp=fopen("./counter.txt","w");
fwrite($fp,$cnt);
fclose($fp);
}
print "Visited: .$count.<BR>";
?>