Size:
Large, Medium,
Small
Sat Jul 4, 09 12:01 PM
| Category:
Sharing
Original Articles: http://cheng-jk.hostei.com/blog/2009/06/basic-hit-counter-in-php
A very basic hit counter in PHP; it uses a text file to store the number of hits and displays the number of current hits.
if (gethostbyaddr($_SERVER['REMOTE_ADDR']))
{
$CntFile = "HitCounter.txt";
$Hits = file($CntFile);
$CurrHits = $Hits[0]++;
$FileHandle= fopen($CntFile, "w"); // Open as a writable file
fputs($FileHandle, $CurrHits);
fclose($FileHandle);
echo "Hits: ".number_format($CurrHits);
}
Original Articles: http://cheng-jk.hostei.com/blog/2009/06/basic-hit-counter-in-php
Link:
http://blog.bitcomet.com/kyliechan/post_101686/
©
Add to favorites |
Quote
Reads (294) | Comments (1)