Go Back   Web Design & SEO Company > Free Scripts

Free Scripts Free Scripts to add to your website, includes Ajax, Javascript, php, Flash, CSS, HTML and more. No registration is required to download, these scripts are provided free to help you make the most of your website.

Old 10-16-2008, 09:44 AM
Junior Member
Join Date: Oct 2008
Posts: 1
Default 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");
fputs($fp, $hits);

//printing hits; you may remove next line (and keep the counter only for your records)
print $hits;


To use this code, copy it to your page in the exact position where you want to show number of hits.

Outsourcing software development
Reply With Quote
Top SEO Tool
Harvester and Mass Blog Commenter
Blog Comment Software


Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
5 Simple Steps to Get Links to your Website Admin SEO 8 08-12-2012 06:53 AM
Simple Orange Wordpress Theme dhanush Wordpress Themes 0 07-31-2009 01:55 AM
Simple Blue Wordpress Theme dhanush Wordpress Themes 0 07-31-2009 01:53 AM
Simple Blog theme navik Wordpress Themes 0 06-03-2009 12:13 PM
Wordpress Theme - WP-Simple-Red Ben.Johnson Wordpress Themes 0 12-08-2008 10:54 AM
Wordpress Theme - WP Simple Blue Ben.Johnson Wordpress Themes 0 12-02-2008 03:57 PM
Wordpress Theme - Plain-Simple Ben.Johnson Wordpress Themes 0 11-26-2008 12:28 PM

Knowledgebase | SEO | Free Scripts | Free Wordpress Themes | Free Graphics

eval gzinflate base64 decode | SEO Addons

Forum time zone is GMT. Currently it's 08:46 AM.

SEO - Top

Web Design & SEO Forums