Comments Posted
body<=
Down for Maintenance
This page used database queries that were horribly unoptimized and killed the rest of the site. This is currently being fixed on the LiveJournal development server, and when it's fixed, the main server will be updated and this page will be available again.";
my $dbh = LJ::get_db_writer();
my $ret = "";
my $user = lc($FORM{'user'});
my $quser = $dbh->quote($user);
my $month = $FORM{'month'};
my $year;
if ($month =~ /^(\d\d\d\d)-(\d\d)$/) {
$year = $1;
$month = $2;
} else {
my @nowtime = localtime();
$year = $nowtime[5]+1900;
$month = sprintf("%02d", $nowtime[4]+1);
}
my $qyear = $dbh->quote($year);
my $qmonth = $dbh->quote($month);
$sth = $dbh->prepare("SELECT * FROM user WHERE user=$quser");
$sth->execute;
my $u = $sth->fetchrow_hashref;
unless ($u) {
return "$user. Sorry. p?>";
}
# get number of posts per month
$sth = $dbh->prepare("SELECT DATE_FORMAT(datepost, '%Y-%m') AS 'month', DATE_FORMAT(datepost, '%Y-%M') AS 'monthpretty', COUNT(*) AS 'count' FROM talk WHERE posterid=$u->{'userid'} GROUP BY 1, 2 ORDER BY 1");
$sth->execute;
%permonth = ();
while ($_ = $sth->fetchrow_hashref) {
$permonth{$_->{'month'}} = { format => $_->{'monthpretty'},
count => $_->{'count'} };
}
$ret .= "$u->{'name'}. You can also view other months this user has posted comments: p?>";
$ret .= "