Free Hit Counter PHP
  See More Stuff on Freegive     

Sponsored Ads

Paid Surveys UK - Online Surveys For Money
Get paid for completing online surveys. Discover the best paid survey at Paid Surveys UK. You can earn up to £50 for each survey completed.

Make Free Money Online
Great way to earn easy cash by working at home on your computer. Get free paid for completing online surveys.

Toluna Surveys
Toluna, the easiest way to ask and answer questions and get rewarded for sharing your opinions.

See your ad here »


 
 
 
 


Add a free hit counter php to your web page

Track the number of uniques or individual visits to your web pages. No email, registration or personal information is required.

Looking for a quick and simple (AND 100% FREE!!) way to keep track of your web page visitors? Well you found it.

Get free contact forms with file upload support and captcha | Download Free Hit Counter Here

Free Hit Counter PHP Code

1. Create a counter text file of the name hitcounter.txt and save it to the same directory you will put your hit counter in.

2. Open your php editor. Save the document as counter.php. Set your opening statement for PHP script.

<?php
?>


3. Set the variable for the file named hitcounter.txt and place this between your PHP tags. remember to place the filename in quotes. place the semicolon on the end of the line to end the command.

<?php
$count_my_page = ("hitcounter.txt");
?>


4. Set the number of visits to the current value of the contents of the hitcounter.txt file:

<?php
$count_my_page = ("hitcounter.txt");
$hits = file($count_my_page);
?>


5. When the script is accessed as the page loads, it not only reads the current number of hits on the page in the hitcounter.txt, it must increase the value by 1 for the current hit to be recorded. Add 1 to your value of $hits and call it $hits.

<?php
$count_my_page = ("hitcounter.txt");
$hits = file($count_my_page);
$hits[0] ++;

?>


6.Open the file that is keeping count so we can write to it

<?php
$count_my_page = ("hitcounter.txt");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
?>


7. Replace the value in the file with the new $hits number after it was incremented.

<?php
$count_my_page = ("hitcounter.txt");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
?>


8. You must close the file next.

<?php
$count_my_page = ("hitcounter.txt");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
?>


9. Set the code to display your hit number.

<?php
$count_my_page = ("hitcounter.txt");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
echo $hits[0];
?>


10. Save your php file in same directory as the text file.

11. To use this script you just have to add a php statement that calls that php file. Use the following include:

<?php
include ("counter.php");
?>


Hit Counter Demo

Demo: Total Views: 18534    »    Download Free Hit Counter Here

Free hit counter php from freegive.co.uk

Please help spread the word by linking to Freegive at ( http://www.freegive.co.uk ) from your website or go to "Add Freegive To Your Site" page. Thanks for your interest in Freegive.



Become a Sponsor

Jobs
Flats And Houses
Business Services
Pets And Animals
Men Seeking Women
Women Seeking Men
Holiday And Travel Partners
Cars, Vans And Motorbikes
Events And Gigs
Charity Work
Ad Posting Rules

More Stuff On Freegive

Make Free Money Online
Guide to Great Websites
Free Contact Form
How to Avoid Scams & Fraud
Money Back After a Scam
Food Recipes
Cocktail Recipes
Get Unwanted Items For Free
Online Shopping
Testimonials - Share Your Story
See More Stuff on Freegive »

About Freegive

About us
Community Forum
Community Recycling Groups
Classified Ads Directory
Pets Directory
Freebies Directory
Terms of Use
Privacy And Safety
Site Map
Search
Contact

Support Us

Facebook
Twitter
Add Freegive to Your Site
Make Freegive Your Homepage
Tell a Friend About Freegive
Follow Freegive on Flickr

Make Free Money Online

Free Online Paid Surveys
Free Money Making Ideas
15 Ways to Make Money
             

Copyright  © Freegive. All Rights Reserved.