This web counter can work as a (javascript based) text counter or as a simple graphical counter. When working as a graphical counter, digit appearance can be configured. It is possible to manage multiple counters by placing counter.cgi scripts in several directories. Specially designed for multiuser sites: a site-wide counter.pl file can be reused by multiple users by "require"ing it in their own counter.cgi files.
GD.pm
Perl module, which can be
found on CPAN (cpan -i GD)
counter.cgi
script
to a place accessible to all users of the system (such as
/usr/local/lib/webcounter/counter.pl
)
The administrator should also make sure that the users have the right
to run cgi scripts (Set Options ExecCGI
in /etc/httpd/httpd.conf
),
and that those cgi scripts run under the user's privileges (suexec
).
$digits='/usr/local/lib/webcounter/digits/classic.gif';
The last line of counter.cgi should call the actual script:
require "/usr/local/lib/webcounter/counter.pl";
counter.cgi
file:
require "/home/tom/webcounter/counter.pl";
<img src="counter.cgi?W=6">
W=6 means that six digits should be displayed.<script src="counter.cgi?js=1"></script>
<script src="counter.cgi?js=1"></script>
<noscript><img src="counter.cgi?W=6"></noscript>
<img src="counter.cgi?test=1">
counter.txt
in
the directory where the counter.cgi
file resides
.pos
file as well. This file is a simple text
file containing the starting x-coordinate of each digit, and the
ending x-coordinate of the last, one per line. Example: a variable width digit strip and its positions file.
In your counter.cgi
file, write:
$digits=/home/user/mydigits.jpg
. The name of the position
file is implied by the name of the digit file: it is obtained by
substituting the .jpg
extension with .pos
.
In this example, it would be
/home/user/mydigits.pos
. For testing your positions
file, you might want to use the test mode of the
counter.
0.jpg
, 1.jpg
, ..., 9.jpg
. In
your counter.cgi
file, write
$digits=/home/user/mydigitdirectory