############################################################################## # The Ultimate CGI Bin Scripts | http://www.popi.net/~chase/tucb ############# ############################################################################## ############################################################################## # Counter | Version 1 ######################################################## ############################################################################## # Copyright (C) 1997, 1998 By Chase Venters. You may use these scripts for ## # free. You may also distribute these scripts freely, as long as they are ## # kept intact, and I get proper credit for the script's creation. If you ## # use this script in internet games, or large products, please include my ## # name and e-mail address in the proper area in your credits, listed as ## # CGI Programmer or such. I assume responsibility for none of any liability ## # issues that may arise from this script's use. If you have trouble working ## # with these scripts, contact "chase@popi.net". It is HIGHLY recommended ## # that you register for the mailing list, at least under the bug reports/ ## # security concerns categories. If you do not, you may never know when a ## # corrected version of the script is released! ## ############################################################################## # Read README for information on this script's configuration. ################ ############################################################################## # ReadMe file # Table of Contents -----+------+----- 1) What does Counter do? 2) How to Install & Configure Counter 3) Usage of Counter 4) Files -=1=- What does Counter do? -=1=- Counter keeps track of the number of visitors at your site. It has 2 image sets that come with it. It works by you putting how many tags you want, one per digit. Thanks to ourdomain.com for the image sets. Counter supports infinate seperate counters. It uses DBM files (UNIX databases) so it will not work on NT without extensive modification and/or some type of DBM for NT, which I have no idea of how to get. -=2=- How to Install & Configure Counter -=2=- Counter is easier than most scripts to install. It involves common setup procedures. You change a varible as you would in any other script. Just change the value between the equal and the semicolon. Anything that is a 'string', or a value containing things other that numbers, must be inside single quotes ('). You configure the script by editing varibles. Below is a table of the varibles and values. Varible ³ Value -----------------+------ $dir Directory where the database is stored $url Virtual path/URL where the number set is stored (0-9) $dbm Contains the name (without extension) to the database $mode The UNIX File Mode to the database $ext The extension to the GIFS in the number set. After configured, edit the first line, #!/usr/bin/perl to point to the perl binary. In this example, it is in /usr/bin/perl. It is usually /usr/bin/perl or /usr/local/bin/perl. If in doubt, ask your ISP. Finally, use your favorite FTP client to FTP into your server. Set your FTP client to ASCII mode. In WS_FTP, click the Ascii radio button. Next, select the script, counter.cgi, and upload it. Once it is there, enable all execute permission. Do this in WS_FTP by selecting the file, counter.cgi, right-clicking, and select chmod. Make sure the only write enabled is the very left, or owner. Next, set the program back to Binary, as you did Ascii. Upload the DBM file to the directory in $dir. CHMOD it all three writes using the same method (ala counter.cgi). Next, change to the directory that $url points to. Make sure the FTP client is in Binary, and upload the image set of your choice(0-9.gif). Counter is now installed and ready. -=3=- Usage of Counter -=3=- The following parameters talk to Counter. Parameter ³ Usage ----------------+------ id The string or number as to which counter to retrieve wd Which digit to return. opt Parameters. *id* A string/number refering to which counter to use *wd* Which digit to return. Starts with 0. *opt* Options. Put a lower-case 'n' (without quotes) in opt keep it from counting. The following example returns a three-digit counter, ID 1. Put these three lines together in one to prevent browsers from adding a space between the last 2 digits. If you are only using counter for a single counter, you can take id=1 out. The src= has to contain the path to counter. If it was in cgi-bin, you would have src="/cgi-bin/counter.cgi ... Goto The Ultimate CGI BIN to get a problem solved. -=4=- Files -=4=- File ³ Description --------------------+------------ images Image sets counter.cgi The CGI file counts.db Count database. Currently contains TUCB counter as of 3/22/98 in slot 0. ReadMe This file