banner image banner image Office of Information Technology banner image banner image

 OIT HOME  ABOUT OIT  SERVICES  DOWNLOADS  STUDENTS  FACULTY/STAFF
Web Development: Web Development with CGIs

Access Counter and Clock

*** 0:0

This is a CGI program to keep record of the raw hits on a web page. The cgi stores the number of hits in a file on your web site. When the page is accessed the program checks that number, increments it by one and displays a .gif image on your page.

Since this cgi gives the number of raw hits only, it counts each hit a page receives, including when the page has been loaded and reloaded by the same user. If you are looking for accurate access statistics of page hits on the UAF server, see the Web Server Access Statistics page.


Calling the Counter CGI
Digit Styles
Counter Options
Additional Documentation

Calling the Counter CGI

The tag in your html document should look like this:

<img src="/cgi-bin/Count.cgi?df=dept2.dat" align=absmiddle>

What this tag does:

img src    begins the image tag

/cgi-bin/Count.cgi    gives the location of the cgi you are calling

df=dept2.dat    defines the name of the data file on your website where the count is stored

Three data files were created for your department when your web account on the UAF server was created. Their names were assigned by appending a digit to your account name and adding ".dat". For example, the Division of Computing and Communications may have a web account called "dcc". The dcc account would have three data files: dcc1.dat, dcc2.dat and dcc3.dat. You will need one data file for every page that has a counter on it. If you need more than three data files, please email the SysAdmin and ask that more be created.

align=absmiddle   aligns the digit images in the absolute middle

The counter program has many options; you can make it work and look the way you desire. The string between ? and " is called the QUERY_STRING. Make sure there is no new lines in the image tag and no space in the query_string. Options in the string are separated by | or &. You can use either one or a combination of both. The options can be in any order and not case sensitive. Here is an example:

<img src="/cgi-bin/Count.cgi?df=dcc2.dat&ft=T|frgb=gold" align=absmiddle>

Digit Styles

Here are the original basic digit styles.

Style A styleA designed by Muhammad Muquit
Style B styleB Borrowed from HTML-access counter.
Style C styleC designed by benjamin@pop3.oro.net
Style D styleD designed by Muhammad Muquit
Style E styleE designed by Muhammad Muquit
See Digit Styles page for more digit style choices.

 

Counter Options

To see some of the counter options displayed, go to the Options Example page.

Parameter What does it do? How does it work? Default display
df=data_file Datafile to store count Specifies the name of the file for storing the count in.
If df=RANDOM is used, it will return a random number.
Unlike all other parameters, the data file name is case-sensitive.
df=random
if no datafile is specified
dd=A Digit Directory Denotes directory of a specific style of digits. 24 styles of digits are available. DD=A
md=X Max Digits Defines maximum number of digits to display. Any value between 5 and 10 inclusive are permitted. Padding with leading zeros is automatic; longer counts are truncated to the given X. MD=6
pad=B Padding with 0's Turn padding on/off in conjunction with MD= setting. Valid values for the Boolean parameter B are Y, N, T, F, 1, or 0. pad=N
Without specification of a MD=value

pad=Y
With specification of a MD=value

comma=B Display comma after every 3rd digit from right. comma= specifies whether to display a comma after every 3rd digit from right. If you use this parameter as true, the left padding with zeros will be turned off. Comma=F
ft=X Frame Thickness You can wrap the counter in an ornamental frame of X pixels.
Use 0 for no frame.
Values over 5 make a nice 3-D effect.
ft=6
frgb=R;G;B Frame Color Specifies the color of the frame in RGB format. Each color component can be specified as a value between 0 and 256, the RGB hexidecimal code or a color name can be used.
Do not use a # before the hex string.
If you use ft= without an frgb= the default color is used.
If you use frgb= without an ft= the frame thickness defaults to 5.

For hex codes, see Netscape's 216 colors.
frgb=blue
srgb=R;G;B
prgb=R;G;B
Change a color of the image to a target color on the fly. Any one color of the image can be changed to a different color on the fly. srgb stands for source color, that is the color to change.
prgb
stands for pen color, that is the target color.
The values for srgb and prgb can be colon separated color components (e.g, srgb=255;0;0), a hex value (e.g. srgb=ff0000) or a color name (e.g. srgb=red).
srgb=00ff00 or
srgb=0;255;0 or srgb=green

prgb=00ffff or
prgb=0;255;255 or prgb=cyan

chcolor=B Change a color in the image. change the default green color to cyan. chcolor=T, and you want to change green to cyan, then you do not need to specify srgb and prgb parameters. 1x1 GIF is displayed. The valid values for the Boolean parameter B are Y, N, T, F, 1, or 0 chcolor=F
negate=B Negate the color Makes it possible to negate the color of the counter digits. Note that the Frame is exempted from negating. Valid values for the Boolean parameter B are Y, N, T, F, 1, or 0. negate=F
Do not negate
tr=B Transparency On/Off You can specify if your counter image will have a transparent color.
tr=Y means there will be a transparent color. It does not matter if the GIF files used for the digits are transparent; you must specify explicitly which color to make transparent.
If you specify a trgb= then you do not need to specify tr=Y.
If you specify tr=Y and do not specify trgb= the default color black will be transparent. The valid values for B are Y, N, T, F, 1, or 0.
tr=F
No Transparency
rotate=B Rotate On/Off The Boolean value B turns on or off rotating. If you use degrees= , rotate= is not needed. Valid values for the Boolean parameter B are Y, N, T, F, 1, or 0. rotate=F
Do not rotate
degrees=X Rotate X degrees Makes it possible to rotate the counter image X degrees. The possible values are:
degrees=90
degrees=180
degrees=270
degrees=360

Note 360 is meaningless as the counter will come back to the original 0 degree.

degrees=270

With rotate=Y and without degrees=X
rotate 270 degrees clockwise

display=X Specifies what to display. display=clock if you want the time displayed
display=date if you want the date displayed
display=counter
dformat=X Specifies date format. use with display=date.
The valid value for X is any combination of MMDDYY (Month-Day-Year). For example, dformat=ddmmyy, dformat=YYMMDD.
dformat=MMDDYY
tformat=X Time format in 12 or 24 hour. Display time in 12 or 24 hour format
tformat=24
tformat=12
timezone=X Display time/date of the specified timezone. Use with display=clock or display=date.
Use this parameter if you want to display time or date of another timezone. The timezone must be specified with a negative or positive four digit offset from GMT, for example: timezone=GMT-0500 or timezone=GMT+0000 or timezone=GMT+0530.
The routine to display time of various timezones are written in a generic way. Therefore, the unix machines will not be aware of daylight saving time because of the way the routine is written. For example, if daylight saving time is on, to display time of NY, the timezone will be timezone=GMT-0500 instead of timezone=GMT-0400.
If the clock displays your local time wrong, specify your timezone with that parameter in order to display the correct time.
None
istrip=B Use of image strip On/Off istrip specifies whether to use an image strip or not. If you specify istrip=F, the program will look for the individual digit image files in the digits/style directory. The valid values for the Boolean parameter istrip are Y, N, T, F, 1 or 0. istrip=T
sh=B Show digits Used to turn display of digits on or off. sh=T means the counter will be displayed and incremented, this is the default behavior.
With sh=F no digits will show, but the counter will still increment. Instead of digits a transparent 1x1 GIF is displayed. The valid values for the Boolean parameter B are Y, N, T, F, 1, or 0
sh=Y
incr=B Increment Count Makes it possible to display the current count without incrementing the count. This can be used to examine the count for reporting or other purposes without adding to the count. Valid values for the Boolean parameter B are Y, N, T, F, 1, or 0.

incr=T
Increment the counter on each invocation
lit=X Display literal Makes it possible to display a given, predetermined string. The valid values for the string X are: digits, a,p,: ,-

None

See Additional Documentation for more in-depth information about "Counter-Terrorism", Error Messages, acknowledgments and a note from the author.


Authors:
Muhammad A Muquit
Kevin J. Walsh

Copyright 1995 by Muhammad A Muquit. Permission to use, copy, modify and sell this program for any purpose is hereby granted without fee, provided that this copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. If the program is included in a book, publication or in a software distribution media for sale, the author must be notified about it. No binary only distribution is allowed. All distributions must include the source and this copyright notice.

THIS PROGRAM IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHOR Muhammad A. Muquit BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Note: This program is developed in my own time. My employer has nothing to do with it.


Popular Links

Support Center
Documentation
MyUA
Blackboard
Elluminate Live
UAF Webmail
Directory
Statewide Webmail
Acceptable Use of Online Resources
Tech Refresh
Wireless/Walk-Up
Software Downloads
Your individual accounts
Employment with UA
Smart classrooms
System IT Council

University of Alaska campuses online services searches System Offices
Login >