cgi scripts

Keeping a count of your visitors

This page is here to tell you how to use web counters on your free Wave Rider Web page. Its easy, and if you use these counters, much faster than using remote count URLs (like http://www.webcount.com).

So first - what is a web counter? A counter gives you a graphical display of how many people have visited your web page. Your counter can have a varity of digit styles, colours, borders - and this page is here to try and explain how to use them.

Contents

  1. The most basic counter
  2. Getting a bit clever with counters (frames and digits)
  3. And finally - I dont want to loose the 60,000 hits I've already counted!

The most basic counter.

A counter is a graphic, just like any other. So, to insert one in a web page, you use the <IMG SRC="xxxx"> tag, just like embedding a GIF or JPEG file in your page. However, the source for the image is actually a CGI script - a program - which runs on our web server. Don't worry if you don't know what a CGI script is, you don't have to. So to add a basic counter on your page, you would use the tag

<IMG SRC="/cgi-bin/Count.cgi?df=username.dat"> where username is your user name (the bit in your email address before the @).

This would produce the following (you can use 'View Source' from the View Menu in Netscape to check that the tag in the page is exactly the same as the one above. We've just used the user name cpage.

OK, things to remember at this point. First, the slashes must be forward slashes. The Count.cgi MUST have a capital C, and you must remember the quotation marks. If your counter doesn't work, check these first.

Now, I know what you're thinking - it works but it looks untidy, because it doesn't line up with the text properly. You can can cure this by using an ALIGN=absmiddle in the img tag. In other words, our tag now becomes

<IMG SRC="/cgi-bin/Count.cgi?df=username.dat" align=absmiddle>

Which produces the following counter : - perfect!


Getting a bit clever with counters

Frames

If you look at the counters above, you'll see that they all have an ornamental border around them. We can alter this so that it is thicker, thinner, etc. etc.

We do this by adding the parameter ft=number between the ? and the & in the CGI call. Sounds complicated - not really - look at these

<IMG src="/cgi-bin/Count.cgi?ft=0&df=username.dat" align=absmiddle> gives us no frame

<IMG src="/cgi-bin/Count.cgi?ft=4&df=username.dat" align=absmiddle> gives us a thin frame

<IMG src="/cgi-bin/Count.cgi?ft=10&df=username.dat" align=absmiddle> gives us a thick frame

<IMG src="/cgi-bin/Count.cgi?ft=20&df=username.dat" align=absmiddle> gives us an extreme frame!

Frame Colours

OK, I knew it wouldn't be long before someone asked this question - how do I change the frame colour? Its almost the same as changing colours with Netscape, again, add a parameter frgb=ff;ff;ff; in the call. The ff;ff;ff is an RGB colour code. So for a black frame, you would use, <IMG src="/cgi-bin/Count.cgi?frgb=0;0;0;&ft=5&df=cpage.dat" align=absmiddle>. The good news is that you can also use names of colours - which will return the correct code to use instead (but obviously you have to take the scripts best guess at each colour. So we could also have used <IMG src="/cgi-bin/Count.cgi?frgb=black&ft=5&df=cpage.dat" align=absmiddle> which would show us on the page - use frgb=0;0;0 instead.

Some examples:

<IMG src="/cgi-bin/Count.cgi?frgb=black&ft=5&df=username.dat" align=absmiddle> tells us the code for a black frame which looks like this

<IMG src="/cgi-bin/Count.cgi?frgb=255;0;0;&ft=5&df=username.dat" align=absmiddle> gives us a red frame

<IMG src="/cgi-bin/Count.cgi?frgb=0;255;0;&ft=5&df=username.dat" align=absmiddle> gives us a green frame

<IMG src="/cgi-bin/Count.cgi?frgb=0;0;255;&ft=5&df=username.dat" align=absmiddle> gives us a blue frame

Digit Styles

Well, these green digits are starting to get tedious aren't they. So, we have a variety of styles for you to try. You specify the style by including a dd=style parameter as before.

So for style A, which is the one we've been using so far, you would specify <IMG src="/cgi-bin/Count.cgi?dd=A&df=username.dat" align=absmiddle> and we'd get this

The following table shows all the different styles you can use, and their names.

A
B
C
D
E

And Finally

What if I already have a counter, and I don't want to loose the hits I've already taken?

Easy. Just add the parameter st=xxxx (where xxxx is the number you want the counter to start from), and things will resume as normal. For example, <IMG src="/cgi-bin/Count.cgi?st=200&df=username.dat" align=absmiddle>.