roro
08-11-2000, 08:26 AM
this is the .pl
#!/usr/bin/perl
# Type The absolute of the the LOG file.
$log = "/home/uninet/data/exam_log.txt";
# Type the absolute path to the counter file.
$count = "/home/uninet/data/exam_num.txt";
# Type name of your site
$name = "Your Site's Name Here.";
# Type the absolute path to the statistic page. (The page that views the log)
$stat = "/home/uninet/www/exm/stat.html";
# What is the ending of the digits (you need to get a full set of 10 images to
#represent the digits)?
$end = ".gif";
$path = "exm/";
$min_length = "000";
#Testing Date
@months = ('Jan','Feb','Mar','Apr','May','June',
'July','Aug','Sept','Oct','Nov','Dec');
@days = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
$date = " $days[$wday], $months[$mon]/$mday/$year $hour:$min:$sec";
# Get Count
open (CD, "$count");
$counter = <CD>;
close (CD);
chop ($counter) if $count =~ /\n$/;
# Increase Count
$counter++;
open (CD, ">$count");
print CD $counter;
close (CD);
print "Content-type: text/html\n\n";
$counter = sprintf("%${min_length}.f", $counter);
$counter =~ s/ /0/g;
@digit = split(//, $counter);
# Print Counter
foreach $digit (@digit) {
$i = "<img src=\"${path}${digit}${end}\" alt=\"${digit}\">";
print "$i";
}
#Logging
open (datk, ">>$log");
print datk "<td>$counter</td><td><a href=\"$ENV{'HTTP_REFERER'}\">$ENV{'HTTP_REFERER'}</a></td><td>$ENV{'REMOTE_ADDR'}</td><td>$date</td><td>$ENV{'HTTP_USER_AGENT'}</td><TR>";
close (datk);
open (datk, "$log");
$data = <datk>;
close (datk);
#Print Sheet
open (logs,">$stat");
print logs "<html><head><title>Statistics for $name.</title></head><body>You've had $counter non-unique hits (details may take awhile to load).<BR><table border = 1><td>Hit No.</td><td>Referer</td><td>IP address</td><td>date</td><td>client</td><TR>$data</table><BR>(C)1997-2000 <a href=\"http://www.roro.com\">roro</a>. Count\+Stat™ V1.5.4 (03.04.2000)<BR><i>$ENV{'SERVER_SOFTWARE'}</i> </body></html>";
close (logs);
how can i execute this program in my web page
#!/usr/bin/perl
# Type The absolute of the the LOG file.
$log = "/home/uninet/data/exam_log.txt";
# Type the absolute path to the counter file.
$count = "/home/uninet/data/exam_num.txt";
# Type name of your site
$name = "Your Site's Name Here.";
# Type the absolute path to the statistic page. (The page that views the log)
$stat = "/home/uninet/www/exm/stat.html";
# What is the ending of the digits (you need to get a full set of 10 images to
#represent the digits)?
$end = ".gif";
$path = "exm/";
$min_length = "000";
#Testing Date
@months = ('Jan','Feb','Mar','Apr','May','June',
'July','Aug','Sept','Oct','Nov','Dec');
@days = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
$date = " $days[$wday], $months[$mon]/$mday/$year $hour:$min:$sec";
# Get Count
open (CD, "$count");
$counter = <CD>;
close (CD);
chop ($counter) if $count =~ /\n$/;
# Increase Count
$counter++;
open (CD, ">$count");
print CD $counter;
close (CD);
print "Content-type: text/html\n\n";
$counter = sprintf("%${min_length}.f", $counter);
$counter =~ s/ /0/g;
@digit = split(//, $counter);
# Print Counter
foreach $digit (@digit) {
$i = "<img src=\"${path}${digit}${end}\" alt=\"${digit}\">";
print "$i";
}
#Logging
open (datk, ">>$log");
print datk "<td>$counter</td><td><a href=\"$ENV{'HTTP_REFERER'}\">$ENV{'HTTP_REFERER'}</a></td><td>$ENV{'REMOTE_ADDR'}</td><td>$date</td><td>$ENV{'HTTP_USER_AGENT'}</td><TR>";
close (datk);
open (datk, "$log");
$data = <datk>;
close (datk);
#Print Sheet
open (logs,">$stat");
print logs "<html><head><title>Statistics for $name.</title></head><body>You've had $counter non-unique hits (details may take awhile to load).<BR><table border = 1><td>Hit No.</td><td>Referer</td><td>IP address</td><td>date</td><td>client</td><TR>$data</table><BR>(C)1997-2000 <a href=\"http://www.roro.com\">roro</a>. Count\+Stat™ V1.5.4 (03.04.2000)<BR><i>$ENV{'SERVER_SOFTWARE'}</i> </body></html>";
close (logs);
how can i execute this program in my web page