editdb.html Contents fonts.html

CGI script for users to manipulate their own counter values
(This program is part of WWW Homepage Access Counter 2.6+)

count_admin.cgi is a CGI program written in Perl for users to manipulate their own counter values. If the admin authorize, the user can also add delete URL in the authentication database. The program supports Berkeley Db 1.85 or GNU gdbm. It uses Perl modules DB_File for Berkeley db and GDBM_File for GNU gdbm. count_admin.cgi has a list of DBM format preferences, defined by @AnyDBM_File::ISA at the beginning of the program. The first found library will be the library count_admin.cgi will attempt to use for all DBM_File transactions. The counter installation program detects the type of database the counter is compiled with and put the database module at the beginning of the list. The installation program will copy it to your cgi-bin directory. Before using it, you have to create the text file for user authorization in cgi-bin directory (default path).

The program uses a text file for user authorization. The name of the scirpt is specified by the variable $guser_textdb at the beginning of the program. The default is:

my $guser_textdb='count_admin.txt';
That means the file count_admin.txt is located in the same directory as the script itself. You can specify a different path if you like, but make sure the file is not accessible from a web browser.

The administrator must create the file count_admin.txt. The syntax of the file is user id, boolean value for user's auth database editing permission, Unix crypted password, url of document root user can manipulate , all separated by a vertical bar |.


In the first line, the first field admin is the user id, the second field 1 indicates that the user admin can edit the authentication database, the third field is the Unix crypted password and the fourth field http://www.fccc.edu/ is the URL of document root user admin is allowed to manipulate.

In the second line all the fields are similar except the second field, which 0 indicating that the user muquit is not allowed to edit the authentication database.

Please be very careful about the document root you set for the user. In our example, the user admin can edit the counter values and auth db for the entire site, but the user muquit can only edit his counter values and manipulate his URLs in authentication database.

I supply a CGI program called counter_admin_help.cgi to help you to create the count_admin.txt file. Have a look at the screenshot

Authentication database
Authentication database is a database of URL WWW Homepage Access Counter uses. If strict_mode=yes in count.cfg file, then anyone wants to put a counter in a web page, the URL of the web page must be in this database. If the URL is not in the auth database, then the user will get a message like below:


Putting URL is authentication database is analogous to creating data files for the users in older versions of counter. It gives the administrators some control.

Authentication database can be manipulated by the program editdb or by the CGI program count_admin.cgi.

If you allow the users to edit this database by putting 1 in the second field in the line of the file count_admin.txt for the user, the user will be able ot put her URL by herself.

How to call
The installation script install the programs count_admin.cgi and count_admin_help.cgi to your cgi-bin directory. To run the scripts, access the URL via your web browser:


See also

Muhammad A Muquit

Page last updated: Sun Sep 19 16:00:50 1999

editdb.html Contents fonts.html