Simple Hit counter
A hit counter will let us know how many times a page is accessed. In case one visitors loads the page several times, the hit counter will increase several times (but this is likely to happen only a few times).
The code for the hit counter bellow will save the number of hits in a file named counter.txt (the name of this file may be changed). Each time the page is loaded, the file will be read, the number will be increased by one and the new number will be saved to the same file.
//The file where number of hits will be saved; name may be changed; p.e. "/counter_files/counter1.txt"
$counterfile = "counter.txt";
// Opening the file; number of hit is stored in variable $hits
$fp = fopen($counterfile,"r");
$hits = fgets($fp,100);
//increading number of hits
//saving number of hits
$fp = fopen($counterfile,"w");
//printing hits; you may remove next line (and keep the counter only for your records)
To use this code, copy it to your page in the exact position where you want to show number of hits.
Outsourcing software development
Blog Comment Software
|Thread||Thread Starter||Forum||Replies||Last Post|
|5 Simple Steps to Get Links to your Website||Admin||SEO||8||08-12-2012 07:53 AM|
|Free Wordpress Theme - Simple Green - Free Download||dpSubi1||Wordpress Themes||0||10-12-2008 06:48 AM|
|Wordpress Theme - Simple blog theme||Ben.Johnson||Wordpress Themes||0||09-29-2008 03:47 PM|
|Free Wordpress Theme - WP Simple 2.0 - FREE Download||dpSubi1||Wordpress Themes||0||08-03-2008 06:13 PM|
|Simple Blue - Free Wordpress Theme||Admin||Wordpress Themes||0||07-07-2008 05:50 AM|