Studio433 Support > Help Desk > Knowledgebase

Search help:

Matt's Visitor Counter


Installing Matt's Counter

Whilst most Perl/CGI scripts are fairly easy to install, this counter script can give a few headaches. Like most Perl scripts, this one comes with instructions but there is the need to an install and additional programme (fly) and also to provide graphic images for the counter.

This tutorial will detail, in a sensible order, the procedure needed to install the features required in order to put a counter on your web page or pages.

No counter is 100% accurate, but Matt's Counter is particularly useful if you want to identify the number of visitors to your site, rather than the total number of page hits. By placing a counter on each page (and it doesn't have to be visible) it will detect the first new hit, but will ignore that user when other pages are visited by virtue of the graphical image of the counter being saved in the user's cache.

This tutorial is written for users of Windows 95/98/NT requiring to install the counter on our Linux-based Virtual Servers.

  1. Download the counter script from . Be sure to download the graphical variety and not the text counter, as they are totally different.
  2. Download the fly programme from .There are a large range of different versions of fly - download the one for Linux 2.1.125 (i686). This is called fly-1.6.5.Linux-2.1.125-i686.tar.gz.
  3. You will also need a programme capable of de-compressing zip and tar.gz files, which are primarily designed for Unix/Linux systems. WinZip is capable of this, you can download this from This is a "shareware" programme.
  4. You also need Telnet SSH client software. See the Telnet SSH Support page for more information.
  5. You also need an FTP programme to upload files to your site, but if you update your own site you probably already have one. We recommend WS_FTP, which can be downloaded from
  6. You also need some counter digits. You can use free ones downloadable from The Museum of Counter Art or elsewhere. Alternatively, you may prefer to create your own as GIF files. They must all be of equal size, but the actual size is up to you - just remember that the smaller the image, the faster the counter will display.
  7. Create a directory on your hard disc for files used during your development work for your site. you might like to call it c:\counttmp .
  8. Decompress the files from into your directory using WinZip. In the process counter zip will create seven files.
  9. Decompress the files from fly-1.6.5.Linux-2.1.125-i686.tar.gz to your directory using WinZip. In the process this will create one file called fly-1.6.5.Linux-2.1.125-i686.tar .
  10. Rename to digit files to 0.gif to 9.gif, regardless of what they came as
  11. Open the file in a text editor (Windows Notepad will do fine) and make the following changes:
    Files and directories
    $count_file = 
    $digit_dir = "/home/studio433/";
    $access_log = "/home/studio433/";
    $error_log = "/home/studio433/";
    $flyprog = "/home/studio433/";
    $fly_temp = "/home/studio433/"; $bad_referer_img = "";
    $referers = ("", "");

    Image settings

    $width = "15";
         Replace the figures quoted here with the actual size of each
    $height = "20"; Replace the figures quoted here with the actual size of each digit.
    $il = "1"; This allows the image to be interlaced. Set to "0" if you don't want it interlaced.
    $frame_width = "0"; Insert a figure here if you want a coloured frame around your counter. Normally you will not!
    $frame_colour = "255,255,255"; You need not set this unless you have set $frame_width to more than 0. The figures entered should be in accordance with the RGB colour system.
    $dot = "X"; Set to "1" to hide the counter (it will make it one transparent pixel). It isn't worth doing this unless you are setting up an access_log which is outside the scope of this tutorial.
    $uselog = "0"; Turns off logging features.
    Save the file, as edited.
  12. Set your start number. If you want your counter to start at a figure greater than 1, open count.txt in your text editor. Change the figure as required. Save the file.
  13. Create a test html page. To test out your counter, containing the following code.
    <P>Counter test</P>
    <IMG SRC="">
  14. Upload to your cgi-bin directory, using your FTP software. You must upload this as an "ASCII" and not "Binary" file or it will not work.
  15. Create a new directory called counter below your main directory
  16. Upload files to your counter directory as follows:
    count.txt Upload this as an "ASCII" file.
    error_log Upload this as an "ASCII" file.
    access_log Upload this as an "ASCII" file.
    bad_referer.gif Upload this as an "Binary" file.
    fly-1.6.5.Linux-2.1.125-i686.tar Upload this as an "Binary" file
  17. Create a new directory called digits below your counter directory.
  18. Upload your digit image files to the counter/digits directory named 0.gif, 1.gif etc. Sometimes these will upload as 0.GIF etc - this is a quirk of Microsoft Windows. If this happens, you will have to manually rename them as 0.gif etc. after uploading.
  19. Upload test.htm to any suitable directory
  20. Start a Telnet SSH session. Start up your preferred SSH software, using your domain name, login and password. This will connect you to the server as if you were sitting in front of the computer running your Virtual Server. The only trouble is that it talks Unix language and not DOS! The most popular commands are listed on our Telnet page, but really all you will need here are:
    cd directoryname To change down a directory
    cd .. To change up one directory
    ls List files in directory
    ls -l List files with details
    chmod Change access permissions of files
  21. In the counter directory, decompress the tar file by typing
    tar xfv fly-1.6.5.Linux-2.1.125-i686.tar . This will create the necessary directories and install the fly programme and associated files.
  22. In the cgi-bin directory, change the permissions of as follows by typing
    chmod 755
  23. In the counter directory, change permissions of files as follows:
    chmod 777 error_log
    chmod 744 bad_referer.gif
  24. You are finished! Try it out by visiting your test page test.htm. If you are happy with the look of it, copy the code into your web pages as required. If you want a neat frame round it, try placing it into a one-cell table with border. An example of this is illustrated below:
    Example counter
    Another example counter
    Without border With border

    This is the code to do this:
    <TR><TD><IMG SRC="">

Matt's counter has many other features, such as the access log, but it is unlikely you will need this as your account already has more comprehensive logging. Details will be found in the ASCII file named README that accompanies the script.

Was this article helpful? yes / no
Article details
Article ID: 14
Category: Web site design
Date added: 2013-08-27 19:17:13
Views: 1190
Rating (Votes): Article rated 3.3/5.0 (23)

« Go back

Powered by Help Desk Software HESK - brought to you by Help Desk Software SysAid