Counter 2.6.0 by Kevin Athey Behold! Software (c)1995 The Most Recent Version ----------------------- Always get the most recent version from: URL: http://www.he.net/~bbsbs/behold/counter.html FTP: ftp://ftp.adnc.com/ftp/dropboxes/bbsbs/behold Server: ftp.adnc.com Directory: /ftp/dropboxes/bbsbs/behold File: cntr???.zip What Is It? ----------- This application can be used in HTML to count and display the number of times a page has been accessed. This is a Windows NT (32-bit) Console Application. Instructions ------------ Always start with a very simple counter and then build it up to what you want. Your first HTML piece should look something like this: where is "." (do not use quotes "" in the URL), where is the directory on am.net the page being counted is stored, i.e. if your URL is http://am.net/abc, the directory is abc; is any id you choose. We strongly recommend the name of the file being counted without the extension, i.e. for http:/am.net/abc/index.htm id would be index. If this doesn't work, you will have to look carefully at how you have things setup. Usage ----- Usage: counter [-f] [-b | -t] [-s] [-n] [-d] [-w<#>] [-r] < -c<#> | > -f - color to render foreground in. -b - color to render background in. -t - index to color which should be transparent. -s - name of one of the standard styles on am.net. -n - no increment, just build GIF. -w<#> - width of counter in # of digits. -r - raw, no HTTP prefix. not useful in HTML, only on the command line. -h - hidden, builds a transparent one by one GIF. -c<#> and are exclusive. -c<#> - specify the number which you want to build. ignores and log. - unique identifier for counting, see above Some More Advanced And Complicated Examples ------------------------------------------- HTML Example: This will put the graphic in your page. The last argument I use in a log which is created in the directory where the program resides. This allows you to have the count be updated. You can also have many counts using only one program, by just passing different names. This will create BLUE numbers on a RED background using the default digits. Another HTML Example: This will create GREEN numbers on a TRANSPARENT background using the default digits. Yet Another HTML Example: This creates numbers using the "a" style. Ultimate Example: See my web page. http://cervantes.comptons.com/home.htm Then view the source. Then look at these two pages. http://cervantes.comptons.com/buftom/buftom.htm http://cervantes.comptons.com/amini/amini.htm View their sources as well. You will see that I am using the same program to count many different pages. (BE SURE TO MODIFY THE URL AND FOR USE AT am.net!) Separating Parameters --------------------- You could use "&" instead of "+" to separate parameters to the counter. Specifying Colors ----------------- When you are specifying colors you must use the following format. RRGGBB, where each pair represents a hexadecimal number. You must include all necessary zeros. Example: FF0000 - Bright Red Example: 00FF00 - Bright Green Example: 0000FF - Bright Blue Counter-Counter-Terrorism ------------------------- Create a file named "counter.cct" which resides in the same directory as the executable. In this text file enter the various names of the machines on which you will have pages which use the counter. Any page which refers to this counter which doesn't have it's address in the "counter.cct" file will be refused a counter and will get the "cct.gif" file in response. Just try it. It really works. Many people have asked what a "counter.cct" file looks like. Here is an example: ---begin counter.cct--- cervantes.comptons.com melville.comptons.com --- end counter.cct--- There is no longer any limit to the number of machines you can specify. Don't Count Me -------------- Create a file named "counter.nct" which resides in the same directory as the executable. In this text file enter the various IP addresses of machines which you don't want the counter to count. The counter will still display the current count but it won't increment the count if the IP which is accessing the page is present in this file. ---begin counter.nct--- 192.215.244.60 192.215.244.58 192.215.244.* --- end counter.nct--- You may use wild cards. This will allow you to prevent an entire domain from being counted. In my example above, the final entry makes the two previous entries redundant. Adding Your Own Digits ---------------------- You can create your own digits. They must be GIFs and they must all be the same height in one group. The naming convention is the digit followed by the style name. Furthermore, if you do create your own digits, please write me and tell me about them or even send them to me. I will want to add them to my digit page (http://cervantes.comptons.com/digits). Raw Output ---------- This parameter (-r) allows you to use the counter from the command line to generate a GIF using the digits for a number. I just added this feature to make it easier than assembling the digits in some paint program. QUESTIONS --------- If you have any questions, write me: kathey@birdbrain.com When writing, please answer these questions first, then tell me about your problem. If you don't answer these questions in your first piece of mail, I will probably just copy these lines to the clipboard and into my reply, and ask you to answer them again. 1. Where is your site? 2. Where is an example of your counter? 3. What is the exact HTML you are using to call the counter? 4. What server software are you using? 5. What are the contents of the "counter.err" file? 6. By examining the "counter.log" file, can you tell if it is incrementing? Cost ---- This product is donation ware. If you want to send me $5.00 or more, I will cash your check. This is totally voluntary. I am simply asking for the money to keep my private site up and keep good software coming your way. Make it payable to Kevin Athey. Mail it to: Behold! Software P.O.Box 83174 San Diego, CA 92138 History ------- DATE VERSION COMMENT ----------- ------- ------- 08 Nov 1995 2.6.0 -CCT file separated into two separate files. One, "counter.cct" serves the Counter Counter Terrorism and two, "counter.nct" which is used to name machines which shouldn't be counted. -If wait time is exceeded on mutex then gracefully exit without producing graphic, but generate error to log. 02 Nov 1995 2.5.1 -Now uses Mutex instead of semaphore. This is the correct solution to multiple instances problem. 01 Nov 1995 2.5.0 -Added "-h" option which creates a one by one transparent GIF, essentially hidden. 01 Nov 1995 2.4.1 -Fixed bug in command line parsing. 13 Oct 1995 2.4.0 -Added error messages for inability to delete old log and rename new log to correct name. -Added "-w" option to allow setting the width of the output. -Added "-c" option which gives you the ability to build any number you like, it ignores the log. -Added "-r" option which doesn't output HTTP header. This allows you to redirect output to a file and generate a GIF. This is not useful within HTML. 03 Oct 1995 2.3.1 -Added a few more error messages to indicate an inability to allocate memory. 28 Sep 1995 2.3.0 -Added "-d" option which allows you to set the location of the digit GIFs. -Replaced dumb file semaphore with real Windows semaphore, which allows for queueing. -Wait for semaphore clear increased from one minute to two minutes. 19 Sep 1995 2.2.0 -Added "-n" option which allows you to show a count without incrementing it. -Digits in a set no longer have to be the same width. Allows me to use all the digits on the digit page. 06 Sep 1995 2.1.0 -Implemented Counter-Counter-Terrorism. -The above feature also prevents you from counting hits from your own machine. 22 Aug 1995 2.0.0 -Complete re-write. -Now uses GD library for GIF manipulation. -Support for transparency. -Uses many different digit GIFs. -If digit is Black background and White foreground, Then you can set the colors of the digits. -Disabled buffering for stdout, decreasing chances of connection reset failure. 10 Aug 1995 1.2.0 -Now has a semaphore to allow multiple instances gracefully. Implemented via a file. -Switches stdout to binary mode for the GIF. Results in more reliable output. -Generates an error log, when there is a failure. Error Log is "counter.err". There are only 3 possible errors that are detected and logged currently. 03 Aug 1995 1.1.1 -Slight bug fixes -Attempted 16-bit version. (A complete failure.) 01 Aug 1995 1.0.0 -Initial release. CREDITS ------- This product uses "gd 1.2" for the GIF manipulation. You can acquire this library at the following location: http://siva.cshl.org/gd/gd.html Here are all the copyrights required by it: gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. Permission granted to copy and distribute this work provided that this notice remains intact. Credit for the library must be given to the Quest Protein Database Center, Cold Spring Harbor Labs, in all derived works. This does not affect your ownership of the derived work itself, and the intent is to assure proper credit for Quest, not to interfere with your use of gd. If you have questions, ask. ("Derived works" includes all programs that utilize the library. Credit must be given in user-visible documentation.) The Quest Protein Database Center is funded under Grant P41-RR02188 by the National Institutes of Health. Written by Thomas Boutell (boutell@boutell.com), 2/94 - 7/95. The GIF compression code is based on that found in the pbmplus utilities, which in turn is based on GIFENCOD by David Rowley. See the notice below: /* ** Based on GIFENCOD by David Rowley .A ** Lempel-Zim compression based on "compress". ** ** Modified by Marcel Wijkstra ** ** Copyright (C) 1989 by Jef Poskanzer. ** ** Permission to use, copy, modify, and distribute this software and its ** documentation for any purpose and without fee is hereby granted, provided ** that the above copyright notice appear in all copies and that both that ** copyright notice and this permission notice appear in supporting ** documentation. This software is provided "as is" without express or ** implied warranty. ** ** The Graphics Interchange Format(c) is the Copyright property of ** CompuServe Incorporated. GIF(sm) is a Service Mark property of ** CompuServe Incorporated. */ The GIF decompression is based on that found in the pbmplus utilities, which in turn is based on GIFDECOD by David Koblas. See the notice below: /* +-------------------------------------------------------------------+ */ /* | Copyright 1990, 1991, 1993, David Koblas. (koblas@netcom.com) | */ /* | Permission to use, copy, modify, and distribute this software | */ /* | and its documentation for any purpose and without fee is hereby | */ /* | granted, provided that the above copyright notice appear in all | */ /* | copies and that both that copyright notice and this permission | */ /* | notice appear in supporting documentation. This software is | */ /* | provided "as is" without express or implied warranty. | */ /* +-------------------------------------------------------------------+ */ * -kevin- *| ep |* BirdBrain Systems * * sick with the good infection *| ip |* Makers of DisKing * * kathey@birdbrain.com *| ha |* * * http://cervantes.comptons.com *| ny |* http://www.he.net/~bbsbs *