A shell wrapper script around
build is supplied to help
you out in compiling. To see the options supplied by
build, at the shell prompt type:
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 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
Compiling with default settings mean:
/usr/local/etc/Counter. Have a look at directory structure for details.
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:
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)
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.
<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.datIn 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.