The Counter

For Windows NT/95

Version 2.2
Over served

Table Of Contents


What's New In Version 2.2

  • Improved access control.
  • inc argument
Back to TOC

Downloading The Counter And Digits

Download counter.zip (~120 KB) by clicking here. OR, if you are upgrading from Version 2.0 or greater, you can just download the the executable, and replace your old counter.exe

Counter.zip comes with:

  • counter.html - this HTML file
  • counter.exe - the actual executable
  • /digits/led/*.gif - GIFs used by the counter (see styles below)
  • readme.txt - a readme and copyright notice
  • counter.cfg - a configuration file (see installation instructions).
A main feature of this counter is the ability to use many different styles of digits. The counter.zip file comes with some digits that look like an LED readout - here's an example:

You may want to download these other styles to use. Please see the installation instructions and the usage instructions below on how and where to unzip these. Note that the LED style is already included in counter.zip.

Style Name Example File
led led.zip
odometer odometer.zip
lcd lcd.zip
speckled speckled.zip
noisy noisy.zip
cyan cyan.zip
eggs eggs.zip
halloween halloween.zip
curly curly.zip
timex timex.zip
red red.zip
orange orange.zip
chalk chalk.zip
scoreboard scoreboard.zip
neat neat.zip
beach beach.zip
electric electric.zip
fancy fancy.zip
frozen frozen.zip
handwriting handwriting.zip
oldstyle oldstyle.zip
sf sf.zip

Or, if you want to download them all, download all.zip.

Back to TOC


Installation Instructions

  1. After downloading counter.zip, you should unzip the file in your /cgi-bin or /cgi-shl directory (see the FAQ if you don't know what I mean here). You should unzip it with the "Use Directory Names" checkbox checked if you are using WinZip 6.0, or with the -d option if you are using PKUNzip, to preserve directory names. The following directories and files are created:
    /cgi-bin (or /cgi-shl)    <--server's CGI directory
       |
       |--counter.exe         <--the CGI script
       |--counter.cfg         <--config file
       |
       |--/doc
       |    |
       |    |--counter.html   <--this file
       |    |--*.gif          <--images used in this file
       |    |--counter.readme <--counter readme file
       |
       |--/digits
             |
             |--/led          <--style name
                |
                |--0.gif
                |--1.gif
                |--2.gif
                   .
                   .
                   .
    
    The counter also creates the file counter.dat to keep track of data and uses the file lock.od as a semaphore.
  2. If you downloaded other styles, unzip them in the same way as above. New directories under the /digits directory will be created.
  3. Edit the counter.cfg file with Notepad
    • Under the [No-Increment-For] section, enter the host name and IP address of each computer that you do not want the counter to count as a visit, one per line. If you want the counter to count every visit, leave this section blank (but do not delete the [No-Increment-For] line).
    • Under the [Allow-Access-To] section, enter the host name, all aliases and IP addresses for each computer and server that you will allow to create links on your server. Unauthorized people trying to create a link will get this message instead: . If you want to allow access to everyone (an unwise decision, but...) then just put a single period in this section.
  4. Proceed to the usage instructions and use the counter on a test page to try it out. Try hitting "Reload" a couple of times to make sure it increments.
  5. If it doesn't work, read the troubleshooting information.
Back to TOC

Usage Instructions

Now has come the time to use the counter in your HTML files. The counter is called like this in your HTML:

<img src="/cgi-bin/counter.exe?arg1=value1&arg2=value2&...&argn=valuen">

where the arguments are:

Argument
(* means required)
Possible Values Meaning
link* anything that doesn't contain a space Uniquely identifies the page calling the counter. This is case-sensitive. See examples below.
width 0,1,2,3,4,5,6,7,8 or 9 The width of the resulting image in digits. Extra zeros will be added to the beginning. If the width is too short for the number to be displayed, it is lengthened so that all digits may be displayed. Default is 4.
style* any directory name under the /digits directory, for example, led, or the reserved value simple. Should not contain spaces Specifies the set of digits to use in constructing the final image, or specifes the use of the simple style 1. Should be all lower-case
ord yes or no (must be lowercase). If ord=yes, an ordinal number will be outputted 2. An ordinal number is a number like 345th, 10871st, 22nd, etc. The default is no
bgcolour RRGGBB or trans When using the simple style, specifies the background colour of the image, or if trans is used, specifies a transparent background. RRGGBB should be 3 2-digit hex values in one string, similar to the HTML command
<BODY BGCOLOR="RRGGBB">
. This argument has no meaning when style does not equal simple. The default is 000000 (black).
fgcolour RRGGBB When using the simple style, specifies the foreground colour of the image. Same format as bgcolour. The default is FFFFFF (white).
inc 0, 1, 2, 3, 4, or 5 Determines how much to increment the counter. Using 0 means the counter will not increment. Using a value less than 0 will result in no increment. Using a value greater than 5 will result in an increment of 5. If you are calling from a computer specified in the [No-Increment-For] section of counter.cfg, this argument has no effect.
Notes:
1The simple style looks like this: This style requires less disk I/O and thus (should) execute more quickly.

2To use ordinal numbers, you need to have GIFs called th.gif, st.gif, nd.gif and rd.gif in your /digits/X/ directory, where X is the style name. Only the LED style comes with these extra GIFs: you will have to create some for the other styles. If you use the simple style, you can always use ordinal numbers if you wish.

Examples
Here are some examples of using the counter. You should change /cgi-bin/ to the name of your server's CGI directory if different.

<img src="/cgi-bin/counter.exe?link=myhomepage&style=led">

<img src="/cgi-bin/counter.exe?link=page2&style=odometer&width=7">

<img src="/cgi-bin/counter.exe?link=page3&style=simple&bgcolour=00FFFF&fgcolour=FF0000">

<img src="/cgi-bin/counter.exe?link=page4&style=led&width=0&ord=yes">

<img src="/cgi-bin/counter.exe?link=anotherpage&style=simple&fgcolour=00FF88&ord=yes">

Back to TOC


Troubleshooting

P: I get the broken-image symbol.

S: 1) Are you using EMWACS?.
2) Try right-clicking on the broken-image icon and selecting "View this image as..."

  • It says "URL Not Found"
    Then you either put counter.exe in the wrong spot, or you mistyped something in your HTML.
  • It asks whether or not I want to save counter.exe!?
    It asks if I want to configure a viewer for type application/octet-stream!?
    The you haven't told your server that the /cgi-bin directory is special, that .exe files there should be executed, not downloaded. Consult your manual or this FAQ.
  • It says "Server Misconfiguration"
    Consult your manual on how to configure your server.
  • It says something like "Can't create child process"
    Your computer is out of memory, or (for WebSite users especially) your \TEMP directory probably has a million little files calle *.in and *.out: delete them.
  • It says something different
    E-mail me the following information:
    • Your URL
    • The Message you do get (if any)
    • the server you are using.
    • whether or not there is a file called counter.err, or counter.dat, and if there is/are such (a) file(s), what do(es) it/they say?
    • your counter.cfg file

P: I get an error message.

S: In your /cgi-bin directory, there should be a file called counter.err. Use a text editor to look at this file: it contains detailed information about the error.

P: The counter won't increment

S: You are using a computer that is in the [No-Increment-For] section of counter.cfg. Either change this file (see installation instructions) or change computers.

P: I get

S: Look at the "Location" field in Netscape. It should be something like this: http://X/.... Now look at counter.cfg and make sure that X is listed in the section [Allow-Access-To]
Also make certain that when creating links you are using Netscape 1.1 or greater! Other browsers do not supply the HTTP_REFERER information used to conrol link creation.

P: My server has been crashing regularly since I started using your counter

S: 0) Read the disclaimer.
1) If you are using WebSite, delete all the *.in and *.out files in \TEMP
2) Try using the simple style to decrease the counter's execution time.
None of those helps
3) Make sure you aren't allowing access to the whole Internet. See installation instructions.
4) counter.cfg or counter.dat may have been correupted. Delete counter.dat (all counters will go to zero) and inspect counter.cfg
5) Buy more RAM
Yeah, right
6) Remove the counter.
Still crashes
7) Then it wasn't the counter: it was something else.

Back to TOC


FAQ

Q: How can I adjust the counter ahead/backwards?

A: Edit the counter.dat file. The format for the counter.dat file is:

# of links
link1 hits
link2 hits
link3 hits
.
.
.
Look for the link that you use for that page, and edit the corresponding hits entry. Be careful! There should only be one space between the link name and the number. Also, if you manually add or delete links, make sure that the first line accurately reflects the number of links there are, and that there are no gaps between lines.

Q: How do I create my own styles?

A: Simply create 10 GIFs, one for each digit. They must all be the same size. Save them as \digits\X\0.gif, \digits\X\1.gif, etc. where X is the style name you want to use (except for simple). Style names may not have spaces, and are limited to 64 characters. You may use transparent GIFs as long as the transparent colour is the same in all 10 GIFs. If you want to use ordinal numbers with this style, you must also create files \digits\X\th.gif, \digits\X\st.gif, \digits\X\nd.gif, and \digits\X\rd.gif. They must be the same size as the digits and should say, respectively, "th", "st", "nd", and "rd".

Q: How can I keep track of hits without having a visible counter?

A: Not sure why people want to do this, but anyway:
In your <img src="...">, put height=1 width=1.

Q: How can I get my web page to load faster when I'm using a counter?

A: You should specify the height and width of the image. Each digit in these style are 15x20, so width = 15*(# of digits displayed) and height = 20. Now put this in your HTML: <img height=20 width=X src="/cgi-bin/...">

Q: I'm using the simple style, but I can't change the background/foreground colour?

A: 1) Did you spell bgcolour and fgcolour correctly? (Americans note the U).
2) If it uses the default colour (black for background, white for foreground) then you didn't specify 3 two-digit hex numbers. Remember that it goes RRGGBB (Read, Green, Blue).

Q: How accurate is the counter?

A: The counter increments everytime it is loaded. It is not loaded when:

  • People with non-graphical browsers see your page.
  • People are not autoloading images
  • People hit "Stop" before it gets loaded.
  • People look at your page with certain browsers that do not like .exe files in img tags.
  • Someone on the [No-Incremenet-For] list looks at the page.
If super accuracy is what you need, check out WebTrends. I may also be implementing a statistics package in the future.

Back to TOC


Credits

  • The counter uses the gd library by Thomous Boutell. The gd library is copyright © Thomous Boutell.
  • The counter uses cgiC by Thomous Boutell. cgiC is copyright © Thomous Boutell.
  • The various styles came from various sources:
    • I drew the led and lcd styles (pretty artisitic, eh?)
    • Doug Mackie of Mackie Digital Media did the following styles: speckled, noisy, cyan, eggs, curly, timex, red, orange, and chalk.
    • Muhammad A Muquit is responsible for the scoreboard style
    • benjamin@pop3.oro.net created the neat style.
    • I believe Heini Withagen created the odometer style.
    • All the other styles were e-mailed to me by someone, and I've long since lost that person's name. Sorry!
  • Thanks to my testers:
  • Thanks also to my dad.
Back to TOC

Who's Using This Counter

... just to name a few ...

Back to TOC