CGI Counter Counter.exe ======================= This CGI program is a hit counter for your web pages. It is designed to be run on a WinNT/Intel box, but probably works on most Win95 systems too. It might be called from your HTML document like this: font=neat : Here the GIF digits is fetched from the directory 'neat'. The font parameter may hold any valid path relative to the directory holding Counter.exe. Examples: font=digits\roman font=..\gifs\letters\led The font directory should contain the files: 0.gif, 1.gif 2.gif, ... 8.gif, 9.gif with GIF images of each digit. inc=ctest,total : Here two counters are incremented, 'ctest' and 'total'. Any number of counters are valid. If a counter name is new it is added with a value of 1. If the inc= parameter is omitted, no counter is incremented. show=ctest : The counter showned in the returned image is counter 'ctest' If this parameter is omitted, parameters font and w has no meaning, and a 1x1 pixel transparent GIF is returned. That way you may count your page hits in counter.txt without having a counter shown on your page. w=3 : The counter will be three digit wide. If the w= parameter is omitted the counter will use six digits. The tag used as example above would: * Increment counters ctest and total * Return a GIF file showing the value of counter 'ctest' in a 3-digit counter using the font neat. The counter data file Counter.txt ================================= The counter values are stored in the file counter.txt which will be created in the directory holding Counter.exe. If you edit this file you must keep the column positions intact: Col 1-15 Counter name, left-justified. Col 16 Space character Col 17-31 Counter value, right-justified. To reset all counters to zero, just delete counter.txt. To reset one counter to zero just delete the corresponding line in counter.txt The counter control file Countctl.txt ===================================== The first time Counter.exe is called it creates the file Countctl.txt in the directory holding Counter.exe. This file may be edited to change the way the counter works. The file isn't an ordinary .ini file but the layout is similar. Countctl.txt contains two sections: [ValidUsers] and [DontCount]. The [ValidUsers] section is used to prohibit others from using your counter on their pages. Whenever counter.exe is called it compares the URL of the page calling it with the URL:s found in this section. The beginning of the calling pages URL must equal one of the lines in [ValidUsers]. If it doesn't, a broken image is returned. The auto-created file will place one line in this section: The domain name of the refering pages URL. On our server [ValidUsers] http://www.webcom.se/ prevents Counter.exe to be called from pages outside our domain. (To be precise: It may still be called from anywhere, but it will return a broken image when called from outside.) Note: * If you want to allow Counter.exe to be called from anywhere place the line 'http' (without the apostrophes) in this Section. The other section, [DontCount] holds a list of IP addresses. If the IP address of the client calling Counter.exe is found in this list, no increment is done of any counter value. The values are shown as normal though. This function was implemented because we didn't want ourself to be counted as visitors on our own pages. If you want to filter yourself out, just add a line with your IP address in this section. The IP addresses may use asterisks as wildcards for any of the four numbers in the IP address. Ex: 198.100.*.* would stop all users with IP addresses beginning with 198.100 from incrementing your counters. The auto-created file will place one line in this section: The IP address of the client user. Notes: * Blank lines may be inserted anywhere in Countctl.txt to make it easier to read. * Comments may be included at the end of any line. A semicolon is used to indicate that the rest of the line is a comment. * The auto-created file will allow the counter to be used from the same domain that used it the first time, and only from that domain. * The auto-created file will count all visitors except the one that called it the first time. The file Countctl.txt could look like this: -------- 8< -------- 8< -------- 8<---- CUT HERE [ValidUsers] http://www.webcom.se/ ; Allow only Webcom pages to use counter [DontCount] 198.100.10.* ; Dont count peoples at our office 198.100.11.1 ; Dont count Bob either -------- 8< -------- 8< -------- 8<---- CUT HERE Questions about Counter.exe should go to pedro@algonet.se