Click here to visit our Sponsor

Megaton CGI Counter support- wwwcount2.3


Introduction
This is a modified version of Muhammad A Muquit's CGI Counter (wwwcount2.3).
(http://www.fccc.edu/users/muquit/Count.shtml)

This counter can also be used to display time and date information. It has multiple uses,which can be implemented such as time zone information see the very bottom of this file. However this is a true counter. It implies that it does not increment repeatedly if the request is made from the same IP address. In this manner it will count the exact amount of true hits to a page.


Quick-Start
Since the counter outputs graphics, the counter must be called from your HTML page as an image using the HTML tag <IMG attributes>.

There are two different methods of accessing the counter service, one for virtual-domain accounts, the other for non-virtual-domain accounts.

For Virtual-Domain Accounts:
<IMG SRC="/cgi-bin/Count.cgi">

The above examples should get a random counter working on your page.



Simple Configuration

To create a true counter for your page you must initialize the counter.We must  include the df= parameter to specify a datafile. The value in this file will be the initial value of the counter.

The datafile is a simple ASCII text file which contains the current count number. You can use whatever name you wish for the datafile, however the datafile must be located in the data directory which is a sub directory of the counter directory. For example:

<IMG SRC="/cgi-bin/Count.cgi?df=homepage.dat">

Will use the datafile "homepage.dat" in the "~/cgi-bin/Counter/data/" directory of your account.


NOTE: If the datafile doesn't exist, the counter program will create a default datafile which will be initialized to 1.In this case however the datafile must be named, example df=test.dat. To initialize a datafile for your counter, simply create an ASCII text file with the number you wish your counter to begin at (this number must be 1 or greater and not have leading zero's). Upload it to the correct directory under the correct name as specified on your df= parameter above.
 



Advanced Counter Features
The following section will describe additional features of the counter CGI.



NOTE: Parameters in the query strings are separated with a |

Frame color and Thickness
A frame with a bluish color is wrapped by default. You have to use ft=0 to ignore this feature.

<img src="/cgi-bin/Count.cgi?ft = 0 ">

This may not work with all browsers. You should use at least one keyword in the query string (for example, df=data_file ). A Random counter is displayed as no data file is specified. The default frame thickness, color and digit style is used.
 

<img src="/cgi-bin/Count.cgi?ft=1">

No df= option, therefore random digits are displayed. Because of ft=1 no frame was wrapped.


 <img src="/cgi-bin/Count.cgi?ft=6">

Random digits. Wrapped frame is with default color and thickness.


 <img src="/cgi-bin/Count.cgi?ft=10|df=x.dat">

Using "x.dat" datafile for count information. Wrapped frame is with default color and asked thickness.


 <img src="/cgi-bin/Count.cgi?frgb=ffd700|df=x.dat">

The wrapped frame is of the asked color and default thickness. The color is used as hex string. Note, DO NOT add # before the string as you use with Netscape. In the query string, if you use a #, everything after # is ignored. So, be careful.

or you use can use the RGB triplets like:

    <img src="/cgi-bin/Count.cgi?frgb=255;215;0|df=x.dat">


 


Comma can be displayed
<img src="/cgi-bin/Count.cgi?ft=0|df=x.dat|comma=T">



Rotation
<img src="/cgi-bin/Count.cgi?ft=0|rotate=Y|df=x.dat">
<img src="/cgi-bin/Count.cgi?ft=0|degrees=180|df=x.dat">
<img src="/cgi-bin/Count.cgi?ft=0|degrees=90|df=x.dat">

The first counter is rotated default 270 degrees toward right, no angle is specified as the rotate keyword is used.
 


Digit Styles
1)  <img src="/cgi-bin/Count.cgi?dd=A|df=x.dat">
2 a)  <img src="/cgi-bin/Count.cgi?dd=B|df=x.dat">
   b)  <img src="/cgi-bin/Count.cgi?dd=B|frgb=69;139;116|df=x.dat">
3)  <img src="/cgi-bin/Count.cgi?dd=C|df=x.dat">
4)  <img src="/cgi-bin/Count.cgi?dd=D|ft=3|df=x.dat">
5)  <img src="/cgi-bin/Count.cgi?dd=E|ft=2|frgb=000000|df=x.dat">
6)  <img src="/cgi-bin/Count.cgi?dd=F|df=x.dat">
 


 

These are the supplied digit styles.


Change any color
Change green color to red

<img src="/cgi-bin/Count.cgi?df=x.dat|srgb=00ff00|prgb=ff0000">


 


Negate the colors

<img src="/cgi-bin/Count.cgi?negate=T|dd=A|df=x.dat">

Note that the digit color is negated but the frame is not.


Transparency
A specific color of the digits can be made transparent on the fly. Note the counter program do not care if your gif images are transparent or not, you have to tell explicitly which color to make transparent. Here we will make the white color of the digit style E transparent. We will not use any frame either, just to make it look simple.

    <img src="/cgi-bin/Count.cgi?dd=E|ft=0|tr=T|trgb=ffffff">




You can use the RGB triplets for the color like:

    <img src="/cgi-bin/Count.cgi?dd=E|ft=0|tr=T|trgb=255;255;255">




Make the black color of the digit style A transparent:

    <img src="/cgi-bin/Count.cgi?dd=A|tr=T|trgb=000000|df=x.dat">
    or
    <img src="/cgi-bin/Count.cgi?dd=A|tr=T|trgb=0;0;0|df=x.dat">
    or
    <img src="/cgi-bin/Count.cgi?dd=A|tr=T|trgb=black|df=x.dat">


 

Make the green color of the digit style A transparent:

    <img src="/cgi-bin/Count.cgi?dd=A|tr=T|trgb=00ff00|df=x.dat">
    or
    <img src="/cgi-bin/Count.cgi?dd=A|tr=T|trgb=0;255;0|df=x.dat">
    or
    <img src="/cgi-bin/Count.cgi?dd=A|tr=T|trgb=green|df=x.dat">
 


Hide the counter
You can keep the counter hidden if you like. You can do this by sh=0. The hit will be recorded but the counter will not be displayed. A 1x1 transparent GIF image is written which gives the illusion. You can use the no-increment feature for monitoring those hits to a secret page (described later>

    <img src="/cgi-bin/Count.cgi?sh=0|df=x.dat">

 A hidden counter is here.


Monitor counter hits
You might have kept your counter hidden (or not). You can monitor the hits from another page just specifying the datafile and the keyword incr=F

    <img src="/cgi-bin/Count.cgi?incr=F|df=page1.dat">
    <img src="/cgi-bin/Count.cgi?incr=F|df=page2.dat">
    <img src="/cgi-bin/Count.cgi?incr=F|df=page3.dat">


Number of digits
Say you want to display the counter in 5 digits only.

    <img src="/cgi-bin/Count.cgi?md=5|df=x.dat">

or you do not want to left pad with zero, you want to display exact digits.

    <img src="/cgi-bin/Count.cgi?pad=0|df=x.dat">
 


 


Literal
You can display a string literally. The valid characters in a string are 0123456789,:-ap

<img src="/cgi-bin/Count.cgi?lit=0123456789">
<img src="/cgi-bin/Count.cgi?dd=B|lit=0123456789">
<img src="/cgi-bin/Count.cgi?dd=C|lit=0123456789">
<img src="/cgi-bin/Count.cgi?dd=D|lit=0123456789">
<img src="/cgi-bin/Count.cgi?ft=0|tr=1|trgb=ffffff|dd=E|lit=0123456789">
<img src="/cgi-bin/Count.cgi?lit=a1,456-:p">



Counter as clock
Display time in 12 hr format.

<img src="/cgi-bin/Count.cgi?display=clock">

Display time in 24 hour format.

<img src="/cgi-bin/Count.cgi?display=clock|tformat=24">

Display date

<img src="/cgi-bin/Count.cgi?display=date">

Other Time/Date related options
Use the time zone parameter to display time or date of any place in the world.

<img src="/cgi-bin/Count.cgi?display=clock|timezone=GMT-0700">

Use the dformat parameter to specify the date format.

<img src="/cgi-bin/Count.cgi?display=clock|dformat=YYMMDD">



 
 

Back to the Index