OK, everybody has a hit counter on their page. But how many people actually make their own? Ya well, I am going to show you how to create a simple page counter in PHP.
This page counter writes to a file that you have created, storing how many hits you have received. The script then reads the text file (counter.txt) and displays it on the page. Let’s take a look at this code in action.
/* Put The Following In A File Called "counter.php" */
Their have been <?
$file = fopen("/home/pinehead/public_html/s/counter.txt", "r+");
$counter = fread($file, filesize("/home/pinehead/public_html/s/counter.txt"));
$file = fopen("/home/pinehead/public_html/s/counter.txt", "w+");
//->Now include counter.txt on your php page.
<? Include("/home/pinehead/public_html/s/counter.php"); ?> Visitors
There is a page counter for PHP. They are, Go Program!
//->Anthony (Getting Smarter As Time goes By)
I hope it has been a useful article.