#! /usr/local/bin/perl
$aclog = 'log.txt';
$max = '500';
$myself = 'http://farbee.fc2web.com/farbee.html';# 自分のホームページを指定する
$aclog = 'log.txt';
$max = '500';
$myself = 'http://farbee.fc2web.com/farbee.html';# 自分のホームページを指定する
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$month = ($mon + 1);
$year = ($year + 1900);
$month = ($mon + 1);
$year = ($year + 1900);
if ($sec < 10) { $sec = "0$sec"; } if ($min < 10) { $min = "0$min"; } if ($hour < 10) { $hour = "0$hour"; } if ($mday < 10) { $mday = "0$mday"; } if ($month < 10) { $month = "0$month"; }
$date = "$month/$mday/$year $hour\:$min\:$sec";
$href = $ENV{'HTTP_REFERER'};
$myself =~ s/\~/.*/g;
if ($href =~ /$myself/i) { $href = ""; }
$href = $ENV{'HTTP_REFERER'};
$myself =~ s/\~/.*/g;
if ($href =~ /$myself/i) { $href = ""; }
open(LOG,"$aclog") || die "Can't Open User Access Log: $!\n";
@lines=<LOG>;
close(LOG);
@lines=<LOG>;
close(LOG);
$DATA = "[$date] $href";
unshift(@lines, "$DATA\n");
pop @lines while @lines > $max;
open(LOG,">$aclog") || die "Can't Open access_log: $!\n";
print LOG @lines;
close(LOG);
unshift(@lines, "$DATA\n");
pop @lines while @lines > $max;
open(LOG,">$aclog") || die "Can't Open access_log: $!\n";
print LOG @lines;
close(LOG);
print "Content-type: text/plain\n\n";
print " ";
print " ";
exit(0);
添付ファイル