ID:186812
 
I need a big favor.
Could someone write me, or at least help me write, a PHP counter? I can write a simple one, but I want one for unique hits, not that if you refresh the page the hits go up.

Please and thanks.
--Joe

[edit]
No MySQL.
And please don't direct me to source code sites. They either don't work or need MySQL.
hotscripts.com

~>Jiskuha
<?php
$filename = "hits.txt" ;

$file = file($filename);
$file = array_unique($file);
$hits = count($file);
echo $hits;

$fd = fopen ($filename , "r");
$fstring = fread ($fd , filesize ($filename)) ;
fclose($fd) ;
$fd = fopen ($filename , "w");
$fcounted = $fstring."n".getenv("REMOTE_ADDR");
$fout= fwrite ($fd , $fcounted );
fclose($fd);
?>


I've been busy. I just remembered you asked for this. Hope it works.

-Ryan