/* usage: chmod 777 page.cnt include this file */ $cookie_name="site-hit-eaglegt"; //gotta be unique global $_COOKIE; $file=fopen("page.cnt","r"); $eek = fread($file,1024); fclose($file); list($page,$count) = explode("::",$eek); $count=intval($count); if(!$_COOKIE[$cookie_name]) { //update teh counter ++$count; $file=fopen("page.cnt","w"); fwrite($file,"{$page}::{$count}\n"); fclose($file); if(!headers_sent()) setcookie($cookie_name,"you've been hit!",time()+(60*60*24*365)); } DEFINE("COUNTERVALUE",$count); unset($page); unset($count); ?>
|
|