Documentation
ccounter.cgi			Version 1.2

Written by Nick Donaldson - countmaster@psyclops.com

Created 12/12/96	Last Modified 4/28/97

Copyright 1997 CLIQ Services Coop www.cliq.com

This program is provided as freeware and may be freely used, as
long as all banners are left intact.

All that I ask in return for use of this program is that if you are
using this program in your site, please let me know so I can check it
out!



counter.cgi is a simple program to generate a graphical web site
counter using server-side includes. It uses cookies to ensure that each
visitor is counted once only per session, and contains provision for
playing an embedded sound file on the first hit, and either displaying
the count without incrementing, or incrementing without displaying.



Installation:

The zip archive ccounter.zip should include the following files:

	ccounter.cgi
	0.gif
	1.gif
	2.gif
	3.gif
	4.gif
	5.gif
	6.gif
	7.gif
	8.gif
	9.gif
	countertile.gif
	alt_gifs.zip
	exclude_browser.html
	unexclude_browser.html
	readme.txt (this file)

The alt_gifs.zip contains alternate gifs from 0-9.

Expand the ccounter.cgi program into the directory where you wish to
run it from (it may be easiest to make this your root html dir).  The
gif files can be placed in your graphics/images dir, but you must
change the $graphicsdir string to reflect their location.  The
ccounter.cgi program file must be set to executable with a chmod 755
command, ie 'chmod 755 ccounter.cgi'.
Place the two html files in your root webspace - you will find out how
to use them later.

I have included a second set of conventional number gifs in the
alt_gifs.zip archive contained within the main archive.

That's pretty much it!

After installation, I have one favour to ask of you;  in return for
free use of the counter, please send me an email letting me know that
you are using my program, and also put a link to my ccounter page using
the countertile.gif image.

The html code looks like this:

<a href=http://www.psyclops.com/ccounter/> <img src=/graphics/countertile.gif border=0></a>

It will produce a linked button that looks like this --> Ta! Usage: Each page to be counted must be assigned a unique name. For instance, if you are counting hits to index.shtml, assign the name "index". Create two new text files in the same directory as the file to be counted: NAME.ctr (in this example, "index.ctr") NAME.bak (in this example, "index.bak") And set their attributes to group r/w. This way, the cgi can write to the files. Next, copy the digit gif files to a graphics directory (the default is /graphics/ The counter is called as a server side include. You should check how your server handles SSIs, but the call will generally be contained in a *.shtml file and should look something like:

<!--#exec cmd="/cgi-bin/counter.cgi PAGENAME COMMAND"-->

Where PAGENAME = the unique name assigned to the page COMMAND = additional parameter passed to program In our example, the basic call would look like:

<!--#exec cmd="/cgi-bin/counter.cgi index"-->

COMMAND allows three seperate options: nocount : Display the count but do not increment noshow : Increment the count but do not display SOUNDFILE : path/name of soundfile to embed. examples would be:

<!--#exec cmd="/cgi-bin/counter.cgi index nocount"--> <!--#exec cmd="/cgi-bin/counter.cgi index noshow"--> <!--#exec cmd="/cgi-bin/counter.cgi index sounds/sound.au"-->

If you want to take advantage of the cookie functions, you must add meta tags into your html pages to set the cookies. The top of your html should look like this:

<HTML> <HEAD> <META HTTP-EQUIV="Set-Cookie" Content="my_cookie=PAGENAME"> <TITLE>Title</TITLE></HEAD> <BODY>

......etc...... Where PAGENAME = the unique name assigned to the page. In our example, the meta tag would be:

<META HTTP-EQUIV="Set-Cookie" Content="my_cookie=index">

Now, each time the page is loaded, a temporary cookie will be set that expires at the end of the session, ie when Netscape is closed. The program checks for the existence of this cookie, and if it exists, displays the count only, without incrementing. This ensures that each visitor is counted once only, even if they reload the page. File Locking: If you wish to use the locking routines, you must uncomment the line marked and add a directory called 'lockdir' to each html directory that you are using the counter with. Change the permissions on the 'lockdir' directories to 777 - ie, group and world writable. Now, each time that the program is run, it checks for the existence of the lock file corresponding to the page that it was called from. If the lock file exists, it means that another user is incrementing the count, and writing to the counter file may corrupt it. The programs waits until the lockfile disappears and increments, or times out after 3 seconds and displays the count with no increment.

last updated 3/24/97
11843 Page Hits Since 4/28/96
Pages maintained by Nick Donaldson.
If you have any comments or find a
broken link, please let me know!
[ Parlour | Mio Bio | Pix | Flix | Bucky Balls | Graffiti Wall | Stephen Hawking | Links ]