[ale] Hit Counter
Terry Bailey
terry at bitlinx.com
Tue Feb 13 22:06:55 EST 2007
Sure. Here it is. Solving the problem would be nice.
#!/usr/bin/perl
#-----------------------------------------------------------------------------
#
# number.pl
# (C) 1994 Eugene E. Devereaux
#
# Permission to use, copy, modify, and distribute this software
# and its documentation for any purpose and without fee is granted
# provided that the above copyright notice appears in all copies.
# It s provided "as is" without express or implied warranty.
#
# Purpose: This CGI script provides an easy way to keep track of HTML
# page accesses.
#
# Installation: 1) This script must be placed in the CGI-bin directory
# 2) Locate number.val file to fit your directory structure.
# The file can be called anything and must have a mode
# of 777. Each reference from HTML should have a unique
# file.
# 3) Add a tag to the html page that you want to count
# accesses on. Something like
# <IMG src="htbin/number.tcl/path/number.val>
# 4) Change /path/number.val for every HTML reference.
#
#-----------------------------------------------------------------------------
$LOCH_SH = 1;
$LOCH_EX = 2;
$LOCH_NB = 4;
$LOCH_UN = 8;
sub lock {
flock(FVAL, $LOCH_EX);
}
sub unlock {
flock(FVAL, $LOCH_UN);
}
sub get_count {
# &lock();
open(FVAL,"$val_path")
|| die "Can't read values file.\n";
$i = 0;
while (<FVAL>) {
chop;
$elv[$i] = $_;
$i++;
}
close FVAL;
$elv[5]++;
foreach $i (5,4,3,2,1) {
if ($elv[$i] > 9){
$elv[$i] = 0;
$elv[$i - 1]++;
}
}
if ($elv[0] > 9) {
foreach $j (0..4) {
$elv[$j] = 0;
}
$elv[5] = 1;
}
open(FVAL,">$val_path")
|| die "Can't write to values file.\n";
foreach $i (0..5) {
print FVAL "$elv[$i]\n";
}
close FVAL;
# &unlock();
foreach $i (0..5) {
$elv[$i] *= 32;
}
}
@num = (
'0x00', '0x00', '0x00', '0x00', '0x00', '0x00',
'0x00', '0x00', '0x00', '0x00', '0x00', '0x00',
'0xe0', '0x07', '0xe0', '0x07', '0xe0', '0x07',
'0xe0', '0x07', '0xe0', '0x07', '0x20', '0x00',
'0xf0', '0x0f', '0xf0', '0x0f', '0xf0', '0x0f',
'0xf0', '0x0f', '0xf0', '0x0f', '0x30', '0x00',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x00',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x00',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x00',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x00',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0xf0', '0x07',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0xf0', '0x0f',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0xf0', '0x0f', '0xf0', '0x0f', '0xf0', '0x0f',
'0xf0', '0x0f', '0xf0', '0x0f', '0xf0', '0x0f',
'0xe0', '0x07', '0xe0', '0x07', '0xe0', '0x07',
'0xe0', '0x07', '0xe0', '0x07', '0xe0', '0x0f',
'0x00', '0x00', '0x00', '0x00', '0x00', '0x00',
'0x00', '0x00', '0x00', '0x00', '0x00', '0x00' );
@bmv = (
'0x00', '0x00', '0xe0', '0x07', '0xf0', '0x0f',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0xf0', '0x0f', '0xe0', '0x07',
'0x00', '0x00',
'0x00', '0x00', '0x80', '0x01', '0xc0', '0x01',
'0xe0', '0x01', '0x80', '0x01', '0x80', '0x01',
'0x80', '0x01', '0x80', '0x01', '0x80', '0x01',
'0x80', '0x01', '0x80', '0x01', '0x80', '0x01',
'0x80', '0x01', '0xe0', '0x07', '0xe0', '0x07',
'0x00', '0x00',
'0x00', '0x00', '0xe0', '0x07', '0xf8', '0x1f',
'0x18', '0x18', '0x18', '0x18', '0x18', '0x1c',
'0x00', '0x0e', '0x00', '0x07', '0x80', '0x03',
'0xc0', '0x01', '0xe0', '0x00', '0x70', '0x00',
'0x38', '0x00', '0xf8', '0x1f', '0xf8', '0x1f',
'0x00', '0x00',
'0x00', '0x00', '0xf0', '0x07', '0xf0', '0x0f',
'0x30', '0x0c', '0x00', '0x0c', '0x00', '0x0c',
'0x00', '0x0c', '0xc0', '0x0f', '0xc0', '0x0f',
'0x00', '0x0c', '0x00', '0x0c', '0x00', '0x0c',
'0x30', '0x0c', '0xf0', '0x0f', '0xf0', '0x07',
'0x00', '0x00',
'0x00', '0x00', '0x00', '0x06', '0x00', '0x0f',
'0x80', '0x0f', '0xc0', '0x0d', '0xe0', '0x0c',
'0x70', '0x0c', '0xf0', '0x0f', '0xf0', '0x0f',
'0x00', '0x0c', '0x00', '0x0c', '0x00', '0x0c',
'0x00', '0x0c', '0x00', '0x0c', '0x00', '0x0c',
'0x00', '0x00',
'0x00', '0x00', '0xe0', '0x0f', '0xf0', '0x0f',
'0x30', '0x00', '0x30', '0x00', '0x30', '0x00',
'0x30', '0x00', '0xf0', '0x07', '0xe0', '0x0f',
'0x00', '0x0c', '0x00', '0x0c', '0x00', '0x0c',
'0x30', '0x0c', '0xf0', '0x07', '0xe0', '0x03',
'0x00', '0x00',
'0x00', '0x00', '0x20', '0x00', '0x30', '0x00',
'0x30', '0x00', '0x30', '0x00', '0x30', '0x00',
'0x30', '0x00', '0xf0', '0x07', '0xf0', '0x0f',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0xf0', '0x0f', '0xe0', '0x0f',
'0x00', '0x00',
'0x00', '0x00', '0xf0', '0x0f', '0xf0', '0x0f',
'0x30', '0x0c', '0x30', '0x0c', '0x00', '0x06',
'0x00', '0x03', '0x00', '0x03', '0x80', '0x01',
'0x80', '0x01', '0xc0', '0x00', '0xc0', '0x00',
'0x60', '0x00', '0x60', '0x00', '0x60', '0x00',
'0x00', '0x00',
'0x00', '0x00', '0xe0', '0x07', '0xf0', '0x0f',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0x60', '0x06', '0xc0', '0x03', '0xc0', '0x03',
'0x60', '0x06', '0x30', '0x0c', '0x30', '0x0c',
'0x30', '0x0c', '0xf0', '0x0f', '0xe0', '0x07',
'0x00', '0x00',
'0x00', '0x00', '0xe0', '0x07', '0xf0', '0x0f',
'0x30', '0x0c', '0x30', '0x0c', '0x30', '0x0c',
'0xe0', '0x0f', '0xc0', '0x0f', '0x00', '0x0e',
'0x00', '0x0e', '0x00', '0x07', '0x80', '0x03',
'0xc0', '0x01', '0xe0', '0x00', '0x60', '0x00',
'0x00', '0x00', );
$val_path = $ENV{"PATH_TRANSLATED"};
&get_count;
$i = 0;
$k = 0;
foreach $chr (0..15) {
$j = $k;
$k +=2;
foreach $nv (0..5) {
$num[$i+($nv*2)] = $bmv[$j+$elv[$nv]];
$j++;
$num[$i+1+($nv*2)] = $bmv[$j+$elv[$nv]];
$j--;
}
$i += 12;
}
print "Content-type: image/x-xbitmap\n";
print "\n";
print "#define number_width 96\n";
print "#define number_height 16\n";
print "static char number_bits[] = { \n";
$i = 1;
foreach $j (0..191) {
if ( $j eq 191 ) {
print "$num[$j] "
} else {
print "$num[$j], ";
}
if ($i eq 12) {
print "\n";
$i = 1;
} else {
$i++;
}
}
print " };\n";
At 05:57 PM 2/13/2007, you wrote:
>What the...?
>
>Can you post the script here? Maybe someone on the list can help divine an
>answer.
>
>Warren
>
>On 2/13/07, Terry Bailey <<mailto:terry at bitlinx.com> terry at bitlinx.com> wrote:
>>Hi,
>>
>>I have just resurrected an old Perl script (hit counter) that worked great
>>about 10 years ago.
>>
>>But the strangest thing now:
>>
>>1) It works perfectly on Firefox on Windows
>>
>>2) It will not display on Explorer on Windows
>>
>>3) It increments by 2 using Firefox on Fedora
>>
>>I know that people can just reload the page, so that accuracy can be off,
>>but it fits into something that I wanted to do.
>>
>>So, unless I can resolve 2) and 3), adios old script.
>>
>>Terry Bailey
>>
>>_______________________________________________
>>Ale mailing list
>><mailto:Ale at ale.org>Ale at ale.org
>>http://www.ale.org/mailman/listinfo/ale
>
>
>
>--
><http://warrenmyers.com>http://warrenmyers.com
>"God may not play dice with the universe, but something strange is going
>on with the prime numbers." --Paul Erd?s
>"It's not possible. We are the type of people who have everything in our
>favor going against us." --Ben Jarhvi, Short Circuit
>_______________________________________________
>Ale mailing list
>Ale at ale.org
>http://www.ale.org/mailman/listinfo/ale
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ale
mailing list