Wow, that's nifty. I never considered using a file.
Originally Posted by mburt
To expand on that, here's how you would use sessions to only increase the count once per visit:
// do this stuff from here ...
$cdata = file_get_contents("counter.txt");
$ndata = $cdata;
$_SESSION['user_id'] = 'user';
$ndata = ($cdata+1);
$handle = fopen("counter.txt","w+");
//... to here BEFORE sending any data to the browser.
echo "\n<br>".$ndata." visits";