Access Services Software Help Center Policies Jobs
home >> services>> web>> cgis >> counter

Setting up a counter

What is an access counter?

An access counter records how many times your web page has been accessed (the number of "hits" on your page) and displays this number on your web page. You may also set the counter to display the current time or date. The access counter program runs on the Bruin OnLine web server; to display a counter on your page you must create an image link to the counter file on the server.

Adding a counter to your web page

  • If you are using a Web Page editor such as Netscape Composer, create an image link to

    "/cgi-bin/Count.cgi?df=sample.dat|dd=B"

  • If you are using a text editor, such as Notepad, copy the line below

    <img src="/cgi-bin/Count.cgi?df=sample.dat|dd=B" align="absmiddle" />

    and paste it into your HTML code, to create the image link.
  • Upload a file called sample.dat (or the name used with the df= option) to the webserver in the root directory, not in the /public_html/ directory. This file must be a text file that contains a single zero as it's contents, with no other numbers or characters. To move to the root directory, open the '..' folder when connecting with an FTP client. If you are in the correct directory, you should see a public_html folder, a usr folder, a bin folder, and possibly other items. For more information on uploading your page, see Uploading your Page to the Server.
  • Change the permissions on your sample.dat file to be read and write for Owner, Group, and Everyone. Follow the instructions on Understanding UNIX Permissions, and substitute sample.dat for gbook.cfg.

Changing the appearance of the counter

Changing the digit style

Four digit styles are available to users of the Bruin OnLine Web Service:

A: counter A B: counter B
C: counter C D: counter D

To change your counter's digit style, change the value of the dd parameter in the image link. To use counter style A, for example, replace dd=B with dd=A (or any other style):

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

Changing the border color

The default color for the counter's border is blue; you may also choose from black, brown, gray, green, orange, red, violet, white, and yellow. To change the border color, add a parameter separator (|), followed by the border color command frgb=, and then the name of the color to the end of the image link, immediately before the closing quotation mark. To change the border color to violet, for example, add |frgb=violet to the end of the image link:

<img src="/cgi-bin/Count.cgi?df=sample.dat|dd=B|frgb=Violet" />

Your counter will now have a violet border:

Violent Border Counter

Changing the thickness of the border

The default thickness of the counter's border is 5 pixels. To change the thickness of the border, add |ft= followed by any number between 0 and 10 to the end of the image link before the closing quotation mark. A value of 0 removes the border; values of 5 or greater produce a three-dimensional effect. To decrease the width of the border, for example, add |ft=2 to the image link:

<img src="/cgi-bin/Count.cgi?df=sample.dat|dd=B|ft=2" />

The counter's border will now be 2 pixels wide:

2 pixel border

Changing the number of digits displayed

By default, your counter will display six digits; counts with fewer than six digits will be padded with leading zeros, while counts with more than six digits will be truncated. To change the number of digits your counter displays, add |md= followed by any number between 5 and 10 to the end of the link:

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

The specified number of digits will be displayed:

5 digit counter

To disable the feature which pads lower counts with leading zeros, add |pad=f to the end of the image link. To add a comma every third digit from the right (automatically disables padding), add |comma=t.

Using the Counter as a Clock or a Calendar

You may also set the counter to display the current date or time instead of the number of times your web page has been accessed.

Displaying the time

To turn the counter into a clock, add |display=clock to the end of the image link:

<img src="/cgi-bin/Count.cgi?df=sample.dat|dd=B|display=clock" />

The counter will now display the time:

Clock

The clock is automatically set to display the time in 12-hour format. To display the time in 24-hour format, add |tformat=24 to the link.

Displaying the date.

To display the date, add |display=date to the end of the image link:

<img src="/cgi-bin/Count.cgi?df=sample.dat|dd=B|display=date" />

The counter will now display the date:

Date

The calendar is automatically set to display the date in the format mmddyy (month-day-year). To display the date in another format, add |dformat= followed by any combination of the letters mmddyy to the link.