Posted by Sanders Kaufman on 09/29/07 03:32
"Dev" <hanudev@gmail.com> wrote in message
news:1191033370.411232.211310@50g2000hsm.googlegroups.com...
> Dear All,
> i have get combination of four PHP script for count the visitor of
> website but when i apply all these i have no answer.
> i am posting the code of all four PHP script below.
I've got a script that does that pretty well:
[code]
class hitcounter{
var $HitCount;
var $DataFile;
function hitcounter(){
$this->DataFile = "hitcount.txt";
$this->HitCount = $this->GetHitCount();
}
function GetHitCount(){
$sTMP = file_get_contents($this->DataFile,false);
if($sTMP < 1){
$iRetVal = 1;
} else {
$iRetVal = $sTMP;
}
$this->HitCount = $iRetVal;
return $iRetVal;
}
function AddHit(){
$iRetVal = (++$this->HitCount);
$oFile = @fopen($this->DataFile,"w",false);
$iBytes = fwrite($oFile,$iRetVal);
$bVoid = fclose($oFile);
$this->HitCount = $iRetVal;
return $iRetVal;
}
}
$oCounter = new bvckvs_hitcounter();
echo ("<br>Page Visits:" . $oCounter->AddHit() );
[code]
[Back to original message]
|