#!/usr/bin/perl -w # n.b. will need updating before 2007! use CGI qw/:standard/;; $theyear = `date +%Y`; $thismonth = `date +%m`; chomp $thismonth; chomp $theyear; # print "current mon: $thismonth\n"; print "Content-type:text/html\n\n"; if (param()) { $name = param('name'); } else { print "I need a name parameter, bozo!"; exit; } # start HTML output &HTML_header($name); # generate current year for ($month=$thismonth-1;$month>=1;$month--) { $themonth = sprintf("%02d", $month); $filename = $theyear . $themonth . ".html"; ($rank, $posts, $percent) = &findposter($name,$filename); &HTML_row($themonth,$theyear,$rank,$posts,$percent); } # generate 2005 $theyear = 2005; for ($month=12;$month>=1;$month--) { $themonth = sprintf("%02d", $month); $filename = $theyear . $themonth . ".html"; ($rank, $posts, $percent) = &findposter($name,$filename); &HTML_row($themonth,$theyear,$rank,$posts,$percent); } # generate 2004 $theyear = 2004; for ($month=12;$month>=1;$month--) { $themonth = sprintf("%02d", $month); $filename = $theyear . $themonth . ".html"; ($rank, $posts, $percent) = &findposter($name,$filename); &HTML_row($themonth,$theyear,$rank,$posts,$percent); } # generate 2003 $theyear = 2003; for ($month=12;$month>=1;$month--) { $themonth = sprintf("%02d", $month); $filename = $theyear . $themonth . ".html"; ($rank, $posts, $percent) = &findposter($name,$filename); &HTML_row($themonth,$theyear,$rank,$posts,$percent); } # generate 2002 $theyear = 2002; for ($month=12;$month>=1;$month--) { $themonth = sprintf("%02d", $month); $filename = $theyear . $themonth . ".html"; ($rank, $posts, $percent) = &findposter($name,$filename); &HTML_row($themonth,$theyear,$rank,$posts,$percent); } # generate 2001 $theyear = 2001; for ($month=12;$month>=3;$month--) { $themonth = sprintf("%02d", $month); $filename = $theyear . $themonth . ".html"; ($rank, $posts, $percent) = &findposter($name,$filename); &HTML_row($themonth,$theyear,$rank,$posts,$percent); } &HTML_footer; sub findposter { my $name = shift; my $filename = shift; my $rank = 0; # read file and create hash open (FILE, "<$filename"); $match = 0; while () { chomp; if (m/>(\d+) Posting history for $name

BNM posting history for $name

END } sub HTML_row { my ($month, $year, $rank, $posts, $percentage) = @_; $total_posts += $posts; my $mwidth = sprintf( "%f", $percentage*$posts/100) * 3; my $pwidth = ($posts * 3) - $mwidth; # print "\n"; if ($rank) { $total_rank += $rank; $total_months += 1; print < END } else { print < END } } sub HTML_footer { my $average_rank = sprintf("%1.1f", $total_rank / $total_months); my $average_posts = sprintf("%1.1f", $total_posts / $total_months); print <

Back to rankings

Back to my BNM area

END my $back = referer(); if ($back) { print "

Back to the ranking page you were looking at

"; } print "

Total posts to date: $total_posts
Average posts/month: $average_posts
Average rank: $average_rank

"; }
$month/$year$posts
$month/$year
(rank $rank: $posts posts, $percentage% off-topic)
$month/$year No postings