<? # author: http://modzer0.cs.uaf.edu/~bishop
# uses two files: pagehits.count and pagehits.ip
# both need to be writable by the webserver
$fcount = fopen( "pagehits.count" , "rw+" );
$count = (int) fread( $fcount, filesize( "pagehits.count" ) );
$fip = fopen( "pagehits.ip" , "rw+" );
$lastIp = fread( $fip, filesize( "pagehits.ip" )); # change $SERVER_ADDR to webadmin's IP to
# ignore the hits by the maintainer of the webpage.
if( $HTTP_SERVER_VARS["REMOTE_ADDR"] != $HTTP_SERVER_VARS['SERVER_ADDR'] )
if( $HTTP_SERVER_VARS["REMOTE_ADDR"] != $lastIp ) {
$count++;
fwrite( $fcount, $count);
fwrite( $fip, $HTTP_SERVER_VARS["REMOTE_ADDR"] );
}
fclose($fcount);
fclose($fip); #now do the not so fancy output.
echo $count ;
?>
|
|