database.html Contents count_admin.html

Program to manipulate WWW Homepage Access Counter databases
(This program is part of WWW Homepage Access Counter 2.6+)


    Usage: editdb [options] <database file>
    Where the options include:
     -c              show the command set
     -f textfile     read items from text file and insert to the database
     -o              overwrite items while loading data
     -v              show the version info

editdb is a program to manipulate WWW Homepage Access Counter databases. It can be used to manipulate existing database or to create a new one. The program is compiled with one of the Berkeley Db 1.85 (or 2.x compiled with 1.85 compatibility), GNU gdbm or ndbm. The system is probed for the available databases, first for Berkeley Db, then GNU gdbm and then ndbm. For robustness and reliability, please with Berkeley Db. It's available at http://www. Read the instructions for building it on Unix with db 1.85 compatibility (--enable-compat185).

The program takes the database path as its first argument. If the database does not exist, it will be created. The type of database is compiled in the program. The data is stored in the database as key and value pairs. For example, For the counter database, the key is the HTTP referer URL and value is the hit:remote_IP. For authentication database, the key is the URL and value is the comment.

New data to the database can be loaded in two ways, interactively or from a text file. Text file should be used if you want to insert large amount of database. Please read the section LOADING DATA for the format of the text file.

Note, the program locks the database while editing, so do not stay long in vedit mode as database will be locked and counter will hang. You'll see messages about locking and releasing the lock.

Command set
After the successful startup, the program goes to a command loop, the following commands are available:

    add                  add data
    edit string          search database and edit
    vedit string         search database and edit with your editor
    delete string        search database and delete
    search string        search database 
    load file.txt        load to database from text file, same as -f switch
    cls                  clear screen
    version              show the version info
    quit                 quit

add - the program will prompt for the key and value to store.

edit string - the program will search the database for the string and display the out by numbering 1 to n. You will be prompted to enter the number to edit. As all the keys of the counter database has http in it, you search for http to search for all the items in counter database. The search is case in-sensitive and partial.

vedit string - works same as edit. Only difference is you will edit the items via your editor. The default editor is vi. You can set your editor by setting the environment variable EDITOR. When in your editor, separate the key and value with the string =>.

$ editdb /usr/local/etc/Counter/db/Countdb 
(Current database:Countdb)
Command> vedit http
<*> Locking database
<*> Unocking database
<->Lock released.

3 items matched.
   1. http://localhost/=>32
   2. http://localhost/ldap/=>5
   3. http://localhost/~muquit/=>100:
Enter the number to edit, * to edit all, Q to quit: *

Starting editor: vim

## editdb 1.1
## Edit WWW Homepage Access Counter database editor
## Syntax is:
## key=>value
## Lines beginning with a hash mark are comments.

delete string - search the database for the string and prompt for deletion. The deleted items can not be recovered.

search string - searches the database for the string and display the item on stdout. On Unix, the output will be piped to your pager. The default pager is more. You can change it by setting the environment variable PAGER.

load file.txt - loads the data to the database by reading a text file. It is same as the command line switch -f filename. The format of the file is:



cls - clears the screen (only on Unix).

version - shows version info. Example:

$ editdb version
(Current database:version)
Command> version

editdb version 1.1
Edit WWW Homepage Counter database. It supports Berkeley DB 1.85 or 2.x with
API support, GNU gdbm and ndbm.
This version is compiled with Berkeley DBHASH support

Author: Muhammad A Muquit
(Current database:version)
Command> q

quit - exit the program.

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.

See also

Muhammad A Muquit

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

database.html Contents count_admin.html