ok, I've found another one!
http://www.akamarketing.com/simple-hit- ... -perl.html
It uses Perl ( whatever it is ), basicly it come to creating a counter.cgi file in a cgi-bin subdirectory with this code
Code: Select all
#!/usr/bin/perl
# the path for the log file
$logpath = "count.dat";
# digits for the counter
$pad = 5;
# opens the log file for reading, will be created if none exists.
open (LOG, "$logpath");
@file = <LOG>; # an array of the file contents
close(LOG);
$count = $file[0]; # the count value is the first line in the file, i.e. $file[0]
$count++; # increments the counter value
open (LOG, ">$logpath"); # opens the log file for writing
flock(LOG, 2); # file lock set
print LOG "$count\n"; # prints out the new counter value to the file
flock(LOG, 8); # file lock unset
close(LOG);
# sets the leading zeros padding for the counter
$pad = "%.$pad"."d";
$count = sprintf($pad, $count);
# prints out the counter
print "Content-type: text/html\n\n";
print "$count";
And an simple SHTML file with this
Code: Select all
<html>
<head>
<title>Basic Hit Counter Example</title>
<style type="text/css">
p {font-family:"Century Gothic", "Sans Serif"; font-size:12pt; color:black;}
</style>
</head>
<body>
<br>
<br>
<br>
<p>You are person number
<!--#include virtual="/cgi-bin/counter.cgi" -->
to view this demo!</p>
</body>
</html>
Their demo works
http://www.design-ireland.net/design/co ... demo.shtml
Yet when I do the same, it only outputs a line
"You are person number to view this demo!"
without any numbers... what do you think might be causing it?
Thanx!
