A text access counter
The Increment subroutine
The complete text access counter script
Seeding the Counter
Adding the Counter to Your HTML Page
With Server Side Includes
Without Server Side Includes
Creating the Template File
Modifying the access.pl Script
A graphical access counter
Incrementing the Counter
Creating the GIF Image
Returning the Graphical Counter Image
The Graphical Counter Script
Calling the Counter with the <IMG> Tag
Seeding the Counter
Before you can use your access counter, you need to supply the file count.dat with the initial count value. This is called seeding the counter. Normally, you can simply create a text file with the number 0 on the first line. This will start your counter at zero. The first person visiting your Web page with the counter would see the access number 1. (For the graphical counter script, you need to seed the count.dat file with the number 1 for the first person visiting your Web page to see the access number 1. You'll learn why in the section "A Graphical Access Counter" later in this article.) If you want to start your counter at a higher number, just change the first line of the count.dat file to that number. For example, if your Web page has already been accessed 342 times, create a text file named count.dat with the number 342 on the first line (use 343 for the graphical counter).