|
Supporting databases
The counter programs supports any of the Berkeley db, GNU gdbm, sdbm and
ndbm databases. At compile time, the type of databases is decided and
compiled with. Please look at the following table to compare the features
of the various databases. It is clear that you should use Berkeley db.
|
The data is stored as key and value pair in the database. The key is the referer URL (the page where the counter is running) and the value is the hits:visitor_IP. Example:
Key=http://www.fccc.edu/users/muquit/Count.html
Value=23345:131.249.1.2
Utilities for manipulating databases
The counter program comes with several utilities to manipulate the
counter database.
Usage: dumpdb db_file
255 250 250 snow 248 248 255 ghost white 248 248 255 GhostWhite 245 245 245 white smoke 245 245 245 WhiteSmoke 220 220 220 gainsboro 255 250 240 floral white 255 250 240 FloralWhite 253 245 230 old lace 253 245 230 OldLaceThe program make the name of the color the key and the red, green, blue components the value. It also converts all the name to lower case. Please look at the Directory Structure for the location of rgbdb.
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.
Here's an example of using editdb, assuming you copied editdb somewhere in your path:
$ editdb /usr/local/etc/Counter/db/Authdb (Current database:Authdb) Command> edit http <*> Locking database <*> Unocking database <->Lock released. 3 items matched. 1. http://localhost/=>Authenticate localhost 2. http://localhost/ldap/=>http://localhost/ldap/ 3. http://localhost/~muquit/=>muquit'spage Enter the number to edit, * to edit all, Q to quit: 3 Edit Key (http://localhost/~muquit/): Edit Value (muquit'spage): Muquit's page <*> Locking database http://localhost/~muquit/=>Muquit'spage * saved successfully! <*> Unocking database <->Lock released. (Current database:Authdb) Command> qIf you have lots of URLs to add, write them in a text file and load the file with editdb. The format of this file is:
URL=>commentHere, URL is the key and the comment is the value. Let put the following two lines in a file called db.txt,
http://www.fccc.edu/users/muquit/=>Auth entry for my homepage http://www.fccc.edu/users/muquit/Count.html=>Auth entry for Counter pageNow add the file to the auth database,
$ editdb -f db.txt /usr/local/etc/Counter/db/Authdb Locking Database Add:http://www.fccc.edu/users/muquit/=>auth_entry_for_my_homepage Add:http://www.fccc.edu/users/muquit/Count.html=>auth_entry_for_Counter_page Lock released.You can use dumpdb to dump the database.
Advantages of using databases
Disadvantages of using databases
|