# nph-count version 0.94 - A WWW page access counter, # Copyright (C) 1996 Frank Cremer # nph-count comes with ABSOLUTELY NO WARANTY; for details see COPYRIGHT ------------------------------------------------------------------------------ CONTENTS 1 What is nph-count? 2 Installation requirements 3 Installation instructions 4 To do list 5 Known bugs and bug report 6 History 7 Changelog 1 WHAT IS NPH-COUNT? -------------------- Nph-count is a CGI program, which counts accesses to pages on a Word Wide Web Server. It also shows a picture of the counter in GIF format. For more information see the documentation on WWW: "http://www.scintilla.utwente.nl/~frank/counter.html" 2 INSTALLATION REQUIREMENTS --------------------------- In order to install this program correctly, the following requirements must be met: - A http daemon must be running on the system - It must be able to run cgi programs (or scripts as they are often called) - You must have write access to the cgi-bin directory or you must be able to run your own scripts (I haven't tested that one, if you do and succeed please send me an e-mail on how you made it work). - There must be a version of GCC installed. Any other C++ compiler might also work, but I haven't tested that. I have compiled it on "GCC 2.7.0", "GCC 2.7.4" and (with a little modification) "Borland C++ 3.1". Any reports of using other compilers might be usefull to make this program more portable. 3 INSTALLATION INSTRUCTIONS --------------------------- Installation exists of three steps. The first part is configuration, the second part is compilation and the third part is copying the program to the cgi-bin directory and finaly creating counters. 1. Configuration This is quiet simple: just edit the file "counter.h" and change the default WWW directory and the HOME directory. The default WWW directory is the root directory which nph-count uses. It cannot access any directories higher than this root. The HOME directory is the directory in the WWW directory where the user directories can be found. 2. Compilation This program should compile fine on most compilers. I used both GCC 2.7.0 and GCC 2.7.4 and didn't get any errors or warnings. 3. Copying After successful compilation copy the file "nph-count" to the "cgi-bin" directory of the http server. Since this directory depends on the server as well as the configuration of the server, I can't tell you which directory it is. This step usually involves root access. 4. Creating counters The httpd server executes cgi program under a specified user name, since "nph-counter" both reads and writes counter files, that specified user must have these rights to do so. So if you create counter files keep in mind that the rights are right. To make a simple counter just put a "0" in a file with an extension ".cnt", for more option see the documentation at "http://www.scintilla.utwente.nl/~frank/counter.html" 4 TO DO LIST ------------ There are still some things to be done. If you can think of any more, I welcome your suggestions. At any case here is what I think that should be done (in no particulary order): - A better cgi interface: a sepparate class for addressing the environment variables. - Support of multiple netmasks and also support of netmasks of hostnames instead of addresses, removing sensitivity to space after a netmask. - Extra protection to ensure that pages on other servers cannot misuse counters on the server where "nph-count" is installed. - User configurable format of the counter picture (for example colors and number of digits). - At this moment "nph-count" reject zero bytes files, this should be changed. - Documenting the source code. 5 KNOWN BUGS AND BUG REPORTS ---------------------------- Currently there are no known bugs, although I am still not quiete sure if automatic reset of the counter functions properly, especially for resets at the beginning of each month. If you find any bugs please inform me, so I can correct them and put an updated version online. 6 HISTORY --------- This project started in June 1995. We wanted to have a counter for our WWW server. We found a cgi shell script which could do the job, but it was terribly slow: it took twenty seconds to deliver a very poor picture in "xbm" format. I decided that I could do better and I just wrote a simple program in C, which was very fast compared to that shell script. The image quality was poor. In November 1995 I came accros the C source of "GIF" encoding routines and I merged them into my source. The program was now able to generate "GIF" output instead of "xbm" output and I could improve it's appearance. Since the program encoded the picture at run time I also could use it for other purposes, like showing statistics. So I added automatic reset to the counter and some drawing routines. These drawing routines can also be used for other applications. I am working on a program that can modify pictures, by reading them and then drawing on them. In this way you can return a picture which depends on some variable. Because of a major error I could not release it until the beginning of Januari 1996. This error was a misconception of mine about the "HTTP/0.9" and the "HTTP/1.0" protocol and some strange behaviour of Netscape 2.0B as a result of that. The case is that "HTTP/0.9" does not work with a mime header for images and "HTTP/1.0" requires such a header. Since I first developped using Netscape 1.22, I did not include a mime header at all. As a result, showing the counter on Netscape 2.0 sometimes worked and sometimes didn't. It took me some time to figure out what was wrong. But now a header will be send depending on if the client uses "HTTP/0.9" or "HTTP/1.0" and everything seems to be working fine. 7 CHANGELOG ----------- Version 0.9 First official release. Version 0.91 * Changed debug info: it now includes version and copyright info. * Extra fonts: normal, bold and scripts * Utility "font2h" to read linux screen fonts and generate a header file out of it (included in case you want to customize the fonts in "font.h"). * Bug fixed: the image would sometimes show an error while simultaneous accessing the same counter. * New formatted output of the counter, it now resembles a mechanical counter a bit more. * Changed Linux's "flock" into "fcntl" to ensure portability. Version 0.92 * Several small internal changes to allow this counter to be compiled on other systems (thanks to Byron Long). * Fixed a bug in comparing netmasks. * The picture of the statistics is now made transparent. Version 0.93 * Nicer statistical output (horizontal lines) * Text output function: allow to return data in text format instead of GIF. Add the parameter "TEXT" on the command line to do this. Version 0.94 * Doesn't crash if there is zero diskspace, i.e. only writes counter, when there is more than 1Mb. * Fixed bug in month (January is now month 1 and not month 0).