Minicounter Class

<?php class Minicounter{ var $uniquefile; var $viewfile; var $ips; var $views; function setIps(){ $handle = fopen($this->uniquefile,"r"); $this->ips = fread($handle,filesize($this->uniquefile)); fclose($handle); } function setViews(){ $handle = fopen($this->viewfile,"r"); $this->views = fread($handle,filesize($this->viewfile)); fclose($handle); } function getViews(){ return $this->views; } function getUnique(){ return substr_count($this->ips,"\n"); } function updateUnique(){ $this->setIps(); if (strstr($this->ips,getenv('REMOTE_ADDR'))==false){ $this->ips.=getenv('REMOTE_ADDR')."\n"; $handle = fopen($this->uniquefile,"w"); fwrite($handle,$this->ips); fclose($handle); } } function updateViews(){ $this->setViews(); $this->views++; $handle = fopen($this->viewfile,"w"); fwrite($handle,$this->views); fclose($handle); } } ?>

Sorry, no info on how to use this... Yet...

Digg This

Need a reliable webhost? Take my word for it and go with Hostgator Green Web Hosting by HostGator