Disclaimer?

Yep! There is one and it is very simple. There are no guarantees regarding this software! Use it at your own risk!

Q. What can cgicount.py do for me?

A. This script in combination with XBMNumbers16x20.py can generate the simplest hit counter that simply counts the number of times your web page was loaded. It reads the number out of a file, increments it by one, stores the new value in the same file, and returns an XBM image. You can easily improve this script by changing the way the hit count information is stored, i.e. by storing it in a database, etc.



Q. How do I hook up cgicount.py to my web site?

A. Just follow these steps:

  1. copy cgicount.py and XBMNumbers16x20.py into your web server's cgi directory

  2. Set the file attributes by executing chmod 755 cgicount.py XBMNumbers16x20.py

  3. create a file that will store the count in your cgi directory. Let's say you called your count file count.

    Attention: This file has to be writable to the user that is used to launch the cgi script. You can use set uid technique if you want this file to be read-only for the general public.

  4. Add the following to the HTML document you want to contain the count:

    <img src="http://www.yourdomain.com/cgi-bin/cgicount.py?filename=count">

    the output should look something like this:

Have fun!

On to the source files: cgicount.py, XBMNumbers16x20.py

Alex Shindich

http://www.shindich.com/