dirstruct.html Contents logfiles.html


Steps to compile and install (Unix)

The counter can be compiled with or without many options. The default is to probe the system to find out if you have needed libraries, if you do have them you'll get the full functionality of the counter. If you don't have them you'll get a stripped down version of it. Install the FreeType font library if you want TrueType Font support. Please read the section TrueType Font support for instruction to install TrueType library. Please read the section Database Support for installing database libraries. After installing the libraries, come back here.

A shell wrapper script around configure called build is supplied to help you out in compiling. To see the options supplied by build, at the shell prompt type:

./build

========================================================================
NOTE: this script is nothing but a nice wrapper around ./configure. So
if you know what "configure" is, use that instead to have more control.
========================================================================

    Usage: build [options]

    where the options include:
       --all                        compile with default settings

       --with-cgi-bin-dir[=DIR]     designated directory for CGI programs,
                                    default is /usr/local/apache/cgi-bin

       --prefix=dir                 counter base directory, default is
                                    /usr/local/etc/Counter

       --with-db[=DIR]              include Berkeyley db 2.x or 3.x support
       --with-db1[=DIR]             include Berkeyley DB 1.x support
       --with-gdbm[=DIR]            include GNU gdbm support
       --with-ndbm[=DIR]            include ndbm support
       --with-sdbm                  include sdbm support. sdbm database
                                    Library comes with the counter.

       --with-ttf[=DIR]             include TrueType font support

       --without-database           don't include database supprt
       --without-ttf                don't include TrueType font supprt

       --clean                      remove object and binary files
       --pristine                   clean real good
       --install                    Install the counter

    Note: If you compile with --all (default setting), your system will be 
          probed for databases and TTF fonts. If Berkeley db or gdbm not 
          found, the supplied sdbm database will be used.

If you finished all the above steps successfully, you are ready to test the counter.

Test the program from command line (Unix/NT)

A shell script is provided to test out the various features of counter. To test the program, at the shell prompt, type:

cd tests
./testcount-sh


The program will create a file called examples.html. Load this file
to your web browser to see the result of the tests.

You can test it out in NT as well, provided you installed the tools from GNU-Win32 project by Cygnus. These tools provide a fairly complete Unix-like environment in NT and they're free.

How to call the program? (all platforms)

If database support is on, just put a line like below in your web page/s:

    <img src="/cgi-bin/Count.cgi" alt="******">

That's it! Have a look at the Example Page.


If you're using old style data files for whatever reason, read the following:
If the web server is running on Unix:
    <img src="/cgi-bin/Count.cgi?df=sample.dat" align="absmiddle">
If the web server is running on NT:
    <img src="/cgi-bin/Count.exe?df=sample.dat" align="absmiddle">
Note: in Unix, the .exe extension is not used to determine a executable. You can call your program anything you like. So, if your server is not on Unix, the name of the counter program will be Count.exe instead of Count.cgi.

The string after the ? mark is called the QUERY_STRING. Make sure there are no newlines in the <img src= line and no space in the QUERY_STRING. In df=sample.dat, df means datafile and sample.dat is the counter datafile. The counter stores the hits in this file. This datafile is supplied. If you configured the counter to allow automatic datafile creation (look at count.cfg file), you can specify a datafile with df like df=count.dat. The file count.dat will be created for you if the permission to the data directory is correct.

If you configured not to allow automatic datafile creation (good thing), you have to create this file in the data directory. Change directory (cd) to the data directory and type:

    echo "1" > count.dat
In NT, go to Command Prompt from Start->Programs and do the same.

The counter program has lots of options, you can make it work and look the way you desire. In the query string, you can use the options described in the table below. The options can be separated by a | or a &. You can use either one or combination of both but I prefer to use & as some browser may not like |. Here is an example:

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

The options can be in any order and not case sensitive.

Anyway, look at this Example Page you will get the picture.


dirstruct.html Contents logfiles.html