afkf webmaster resources

PHP Counter Script

a simple script for use with html and php files
Contents Menu
Return to Main Page
Shopping (UK)
Clothes Shops
Computer parts
Department Stores
Electrical Retailers
Film and TV
Gadget shops
CD's and music
Mobile Phone shops
Internet webspace
Online Fun
Online poker sites
Paid surveys
Other Things
Webmaster resources
Whats my ip?
Other Links
Webmaster Resources >>> Misc Articles >>> PHP counter script
A Simple PHP Counter Script for use with a HTML webpage

About this counter script:
The total number counted is stored in a text file called "counter.txt"
There are 2 ways you can use it on your site.
  1. Silently
      (so it is not shown on your site but you can check by visiting counter.txt)
  2. Displayed - So the Counter is dispayed on your site for everyone to see.

How to use this counter script:
  1. Copy the above Script to a text file, and save it as counter.php
  2. Create a blank text file "counter.txt"
  3. Upload both to your server to the same folder as the page your using the
     counter on, then right click on the counter text file on your server and set
     the write properties for all users (so the text file can be written to for the
     counted number)
  4. Depending on how you want the code to run insert the following codes
     into the webpage your using the counter on.

  Silently
  Insert the following code into the page you want to count the visitors on:
<script type="text/javascript" src="counter.php"></script>

 Displayed - The total visitors for this page is:
  Insert the following code into the page you want to count the visitors on:
<IFRAME src="
counter.txt" width="15" height="15" frameborder="0" border="0" scrolling="no" marginheight="0" marginwidth="0"></IFRAME>


You may need to adjust the width, height and the other attributes of the iframe to suit your page.


For use with a PHP webpage
simply paste this code in anywere you want it to appear on your page



Then upload a counter.txt file and remember to set the write properties

php counter script
Error404 example
www.afkf.com