Find it online at ScriptSearch.com or download directly at WebCounter.zip
counter.pl - Simple, customizable text or graphic web page counter
This counter script does not require SSI, GD or other server side support other than CGI access for the script itself and storage for the digit graphic files if you choose to use them.
Install the script in cgi-bin & chmod 775
Put
<script language="javascript" src="/cgi-bin/counter.pl"></script>
in your HTML page.
See USAGE for configuration options
Here are the steps to install and use this script
To use this script put a line similar to the following into your html source where you want the counter to appear.
<script language="javascript" src="/cgi-bin/counter.pl"></script>
Two types of parameters to the script are supported. The first is a path which is used to determine what counter to update. This should follow the script name. No path specs are allowed, just a file name. For example
/MyCounter.cnt would be:
<script language="javascript" src="/cgi-bin/counter.pl/MyCounter.cnt"></script>
All counter data files will be created in the cgi-bin directory. If no name is specified, the default name is used. The default name is configurable in the config section of the script.
The other type of parameters to the script affect settings of the script. These are all passed as part of the query string (the part after the '?'). Multiple parameters should be seperated with a '&' sign. Parameters that require values should be followed with an equal sign ('=') and the value to be set. Below is a list of parameters, their meaning and an example of usage
All parameters are specified in lower case (although values may be in either case, but see the CAVEATS for some warnings)
graphics - Forces graphical counters
Example:
/cgi-bin/counter.pl?graphics
text - Forces text counters
Example:
/cgi-bin/counter.pl?text
hidden - Display nothing, just increment the counter
Example:
/cgi-bin/counter.pl?hidden
digits=n - specify the minimum number of digits to use for the counter
where 'n' is the number of digits.
Example:
/cgi-bin/counter.pl?digits=5
This would force there to be at least 5 digits in the output counter
style=s - specify the style of graphical counter to use. This parameter
forms the name of the digit file name after the number and before the
file extension. Replace 's' with the base name of the image files.
Using this parameter forces the script into graphics mode (implies '?graphics')
Example:
/cgi-bin/counter.pl?style=57CHEVY
This would attempt to use files of the form n57CHEVY.GIF for each of the digits in the output (with 'n' being replaced by the digit).
Any number of counter styles may be installed on your server (limited only by the available disk space). A huge collection of counters exists online at http://www.digitmania.com. Simply download them and put them in your digit directory.
NOTE: See CAVEATS below
retrieve - just retrieve the counter value, don't increment it.
This parameter is useful for creating pages to view all your counters without incrementing them or to use a counter value more than once on a page.
Example:
/cgi-bin/counter.pl?retrieve
There are several 'gotchas' to CGI usage and counter.pl is no different. Make sure you consider each of the following.
?style tag because it will likely
be interpreted case sensitively (e.g. ?style=7seg and ?style=7SEG may not
be the same thing).
This same warning goes to configuration items as well. The file extension must be specified in the correct case or it may not work. The image path must likewise be in the correct case or it may not work properly.
The following examples may be used to test your installation. The last few will require that you have the appropriate digit files installed.
<H2>GRAPHICS</H2>
<p>Index: <script language="javascript" src="/cgi-bin/counter.pl/index.cnt?graphics"></script><br>
<p>Count: <script language="javascript" src="/cgi-bin/counter.pl/count.cnt?graphics"></script><br>
<p>Blank: <script language="javascript" src="/cgi-bin/counter.pl?graphics"></script><br>
<H2>TEXT</H2>
<p>Index: <script language="javascript" src="/cgi-bin/counter.pl/index.cnt?text&retrieve"></script><br>
<p>Count: <script language="javascript" src="/cgi-bin/counter.pl/count.cnt?text&retrieve"></script><br>
<p>Blank: <script language="javascript" src="/cgi-bin/counter.pl?text&retrieve"></script><br>
<p>TESTS</H2>
<p>Hidden: <script language="javascript" src="/cgi-bin/counter.pl/index.cnt?text&retrieve&hidden"></script><br>
<p>Digits = 1: <script language="javascript" src="/cgi-bin/counter.pl/index.cnt?text&retrieve&digits=1"></script><br>
<p>Digits = 7: <script language="javascript" src="/cgi-bin/counter.pl/index.cnt?text&retrieve&digits=7"></script><br>
<p>Style = 7seg: <script language="javascript" src="/cgi-bin/counter.pl/index.cnt?text&retrieve&digits=5&style=7SEG"></script><br>
<p>Style = 57chevy: <script language="javascript" src="/cgi-bin/counter.pl/index.cnt?text&retrieve&digits=5&style=57CHEVY"></script><br>
<p>Style = realaba: <script language="javascript" src="/cgi-bin/counter.pl/index.cnt?text&retrieve&digits=8&style=REALABA"></script><br>
<p>Style = cntdwn: <script language="javascript" src="/cgi-bin/counter.pl/index.cnt?text&retrieve&style=CNTDWN"></script><br>
This software is copyright (c) 2002 by James H. Brown and BL Design Solutions, LLC. All rights reserved, world wide.
You may contact the author at james.brown@bldesign.com or james@hmpg.net
This software is free software and may be distributed under the same terms as PERL itself.