counters

Terry Foster (str8aro@vnet.ibm.com)
Mon, 10 Jul 95 16:13:27 EDT


Message-Id: <9507102028.AA14440@www10.w3.org>
Date: Mon, 10 Jul 95 16:13:27 EDT
From: "Terry Foster (444-5361)" <str8aro@vnet.ibm.com>
To: www-html@www10.w3.org
Subject: counters

>Wesley Lemke writes:
>I would like to set up a counter ........

Since a counter is incremented each time a user
accesses a server .... a program must run on the
server to:
1. Read the existing count (usually kept in a file)
2. Increment the existing count
3. Store the count for the next time
4. Return the incremented count to the client in some fashion.
   Most implementations return the count as a graphic
   (.xbm is the easiest to build and understand, but there
    are GIF generators too).

So, what kind of program does the server run, and how
do you tell the server to run it?
The program is a CGI program, typically stored in the
server's cgi-bin directory.
It (counter.exe in this example) can be written
in any language that your server supports, on Unix typically
Perl. I also have an OS/2 Rexx counter implementation
that returns an XBM.

If the count is returned as an IMAGE you can tell the
server to run the CGI program on an IMG tag in the html
for your page. Like so:

This page has been accessed <img src="/cgi-bin/counter.exe">
times.

Cheers,
Terry Foster