Navigation Map

Help Desk Home


Network Operations Center

Trouble Shooting
Special Characters

Password Control
Mime Types
Web Stats

CGI Basics
Custom CGI
File Permissions
Custom Errors
Virtual Domain FAQ
Secure Server Info

IO Web Helpdesk - Counters

You can add a counter to your page by adding the following line to your HTML document:

If you have a virtual domain name, you must copy the script into your own cgi-bin directory and change the tag so that the path to the counter script reflects the path to your own cgi-bin directory.

You will also need to make your HTML file user-executable. To do this, you can type chmod u+x [filename] at the UNIX prompt. Some FTP clients allow you to change permissions as well.
We have put together an informative page containing examples of common SSI's you can use in your web pages. There's also a page of example counters.

This is a quick and simple solution for a counter, however it is important to note that a hit counter is not a reliable way to track statistics on your web page. Also, if you want control of your own count file, you will need to run a counter from your own cgi-bin directory. We do not reset individual counters using the above counter due to the number of other counters that would be affected. Also, note that we do occassionally reset the entire counter in order to clear up old counts for closed accounts, or with major webserver configuration changes.

Here is the procedure for setting up your own counter:

Execute the following commands from the command line, in your public-web directory.

  1. Create your own cgi-bin directory: % mkdir cgi-bin
  2. Set the permissions appropriately: % chmod 775 cgi-bin
  3. Copy the counter script to your own directory:
    % cp /home/www/cgi-bin/ cgi-bin/
  4. Change directories: % cd cgi-bin
  5. Unzip the file: % unzip
  6. Change the permissions on the counter script: % chmod 775 counter.cgi
  7. Change the permissions on the count file: % chmod 777 counter.txt
  8. Read the readme file
  9. Open the counter script in an editor, you will need to edit several fields: % pico counter.cgi

    - Change the path to the Perl interpreter, it should read: #!/usr/bin/perl

    - Scroll down a bit and modify the path to the counter and the path to the images. For instance, if your username was jetboy, these two lines would read:
    $pathtocounter = "/usr/u/j/jetboy/public-web/cgi-bin/counter.txt";
    $pathtoimages = "";

  10. Save the file and exit.
  11. Here is how you would call the script from your HTML file:
    If you are calling the counter from another level other than the root of public-web, you need to make the path in this include relative. In other words, if the page that contains the include is at, the counter tag should point to "../cgi-bin/counter.cgi".
  12. This counter is configurable, you can have it display a graphical odometer type counter or a simple text counter. Read the readme file for more info.

    If you have a Virtual Domain Account you must complete two more steps

    1. Move the GIF images out of your cgi-bin directory:

      - % mv *.gif ../htdocs/

    2. Change the path to the images in the script:

      - $pathtoimages = "";

    Last revised November 19, 1999