--> 脚本:perl_calendar.pl
使用模块:HTML::Calendar::Simple
安装模块:
cpan HTML::Calendar::Simple
如手动,需安装以下两个包:
Date-Simple
HTML-Calendar-Simple
将其存放在cgi目录中添加可执行权限
#!/usr/bin/perl -w
#Script Name: perl_calendar.pl
#author: supersun@gmail.com
#url: http://supersun.biz
use strict;
use HTML::Calendar::Simple;
use CGI qw/:all/;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime;
my $awstats_path="/awstats/awstats.pl";
print header(-charset=>'gbk');
if(param('host')){
$year+=1900;
$mon++;
my $host=param("host");
my $link_tag=1;
print start_html("awstats for $host");
print h1({-align=>"center"},"awstats for $host"),hr({-align=>"center"});
print "<table border='1' align='center'>\n";
print "<tr>\n";
foreach my $month (01..12)
{
print "<tr>\n" if($month =~ /5|9/);
print "<td valign='top'>";
my $cal = HTML::Calendar::Simple->new({ 'month' => $month, 'year' => $year});
foreach my $day (1..31){
my $location=$awstats_path."?config=$host&databasebreak=day&day=$day&month=$month";
if($month eq $mon && $day eq $mday ){
$link_tag=0;
$cal->daily_info({'day' => $day, 'pin_up'=>'now'});
}
if( $link_tag eq 1){
$cal->daily_info({'day' => $day, 'day_link' => $location});
}else{
$cal->daily_info({'day' => $day });
}
}
my $html = $cal->calendar_month;
print $html;
print "</td>\n";
print "</tr>\n" if($month =~ /4|8/ );
}
print "</tr></table>\n";
}else{
print "You must input a host: ",start_form,"Host: ",textfield('host'),submit,end_form;
}
print end_html;
界面如下:
使用awstats按日分析参考:
http://www.chedong.com/blog/archives/001293.html

发表评论