FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.
Knowledgebase: Pre-Installed Scripts
Adding Counters, Clocks, and Dates
Posted on 16 December 2003 10:09 AM
Note: The scripts located in this section are only available for use on a web site that is hosted by FutureQuest®. You are welcome to view the individual script pages for links to the author's homepage, when available, for your further investigation.

Adding a counter to a page is very easy. All you need to do is place an "<IMG SRC=...>" tag in your page that calls the counter program.

For instance, this page has been accessed times so far. The HTML tag to generate that graphic is simply:

<IMG SRC="/cgi-sys/Count.cgi?df=FileName.xxxx" align=absmiddle>

The counter program is very powerful, although this page only shows a couple of simple examples. The only feature used in the above example is the "df" option that lets you name the file used to hold the count. Every page that contains a reference to the "Count.cgi" script with the same filename on the "df=XXX" tag will update the same number. So you can share counters among a number of pages or have independent counters.

Here's another example, using the Count.cgi script to print a digital clock instead of a page counter. The current time here on the East Coast is . To change time zones, you only need to add the timezone=GMT-0100 for any difference from GMT. Again the code is very simple:

<IMG SRC="/cgi-sys/Count.cgi?display=clock">

You can even change the colors, frames, transparency and more. FutureQuest® has also installed a variety of different images you can use for your counters. Click Here to set up a counter automagically and view many of the image options.

Here are some examples of the (very extensive) options available for controlling the look and feel of the counter program. Please refer to the author's homepage for complete documentation. (Note: FutureQuest® has pre-installed version 2.4 of this software.) You can cut-n-paste any of the following and experiment if you like. The HTML required to produce each of them is listed to the right of the graphic.


The "dd=" options controls the digit style:

<IMG SRC="/cgi-sys/Count.cgi?df=cfile1|dd=A">

<IMG SRC="/cgi-sys/Count.cgi?df=cfile|dd=B">

<IMG SRC="/cgi-sys/Count.cgi?df=cfile2|dd=C">

<IMG SRC="/cgi-sys/Count.cgi?df=cfile2|dd=D">

<IMG SRC="/cgi-sys/Count.cgi?df=cfile2|dd=E">


The following samples use the "dd=" option with clocks:

<IMG SRC="/cgi-sys/Count.cgi?display=clock">

<IMG SRC="/cgi-sys/Count.cgi?display=clock|chcolor=T">

<IMG SRC="/cgi-sys/Count.cgi?display=clock|dd=B">

<IMG SRC="/cgi-sys/Count.cgi?display=clock|dd=C">


Here they are with the "Date" option:

<IMG SRC="/cgi-sys/Count.cgi?display=date">

<IMG SRC="/cgi-sys/Count.cgi?display=date|chcolor=T">

<IMG SRC="/cgi-sys/Count.cgi?display=date|dd=B">

<IMG SRC="/cgi-sys/Count.cgi?display=date|dd=C">


The "ft=" option controls the width of the frame border:

<IMG SRC="/cgi-sys/Count.cgi?df=cfile|dd=B|ft=0">

<IMG SRC="/cgi-sys/Count.cgi?df=cfile|dd=B|ft=5">

<IMG SRC="/cgi-sys/Count.cgi?df=cfile|dd=B|ft=10">

<IMG SRC="/cgi-sys/Count.cgi?df=cfile|ft=12|frgb=25;80;8">

<IMG SRC="/cgi-sys/Count.cgi?df=cfile|dd=B|ft=10|frgb=180;30;12">


Rotate the counters and clocks with the "degrees=" option added in:

<img src="/cgi-sys/Count.cgi?df=cfile|dd=B|degrees=270|ft=10">

<img src="/cgi-sys/Count.cgi?df=cfile|dd=B|degrees=180|ft=10">

<img src="/cgi-sys/Count.cgi?df=cfile|dd=B|degrees=90|ft=10">


You can make the counter images opaque with the "tr=1" (transparency) option:

<IMG SRC="/cgi-sys/Count.cgi?df=xx|ft=0|tr=1">

<IMG SRC="/cgi-sys/Count.cgi?df=xx|ft=12|tr=1|frgb=25;80;8">

<IMG SRC="/cgi-sys/Count.cgi?df=xx|dd=C|ft=10|tr=1|frgb=180;130;2">


For the default counter, changing the color of the numbers is easy with the "prgb=" option:

<IMG SRC="/cgi-sys/Count.cgi?df=abc|ft=0|prgb=200;20;180">

<IMG SRC="/cgi-sys/Count.cgi?df=abc|ft=0|tr=1|prgb=200;20;180">

<IMG SRC="/cgi-sys/Count.cgi?df=abc|ft=0|tr=1|prgb=20;10;60">

<IMG SRC="/cgi-sys/Count.cgi?df=abc|ft=0|tr=1|prgb=100;90;8">

<IMG SRC="/cgi-sys/Count.cgi?df=abc|ft=0|tr=1|prgb=20;30;160">


What's the maximum number of hits the counter can handle?
Answer: By default compile time option, it can handle digits up to 80 characters long. Now a pop quiz: If a site gets one million hits/day, in which year will the counter overflow?

How can I change the starting number or reset the counter?
Answer: In order to change that setting, you would need to either:
1. Revisit the Counter Generator Form at http://service.FutureQuest.net/kba111 and enter in the desired starting count and specify a new filename
OR
2. Manually change the filename (df=) and starting count (st=) in the appropriate places in the code

The counter seems to display a random number. What's the problem?
Answer: If you do not specify a datafile with df= parameter, the counter will display a random number.

The counter is not counting?
Answer: The counter never counts the same IP address two times in a row. Please click here for a more detailed explanation.

For more information on the counter program, please refer to the author's extensive notes on the subject. The URL for his homepage is http://www.muquit.com/muquit/software/Count/Count.html