#!/usr/bin/perl use strict; #use lib 'C:\Inetpub\wwwroot\Sites\asp\echoingw\members\login.'; use lib '.'; use MyBoard; # declare variables my($sth, $rv, $f, $count); my($limit); # untaint the limit count if ($cgi->param('start') =~ /^(\d+)$/) { $limit = $1; } else { $limit = 0; } # how many msgs to display per page my($maxcount) = 5; &do_header($maintitle); ## BEGIN HEADER PAGE CONTENT ## my($today) = ""; $count = 0; # delete the forum_id stuff in the query, # alter the date format to read "Thursday, May 8, 2002" # and format the time into "12:30 PM" # $sth = $dbh->prepare("select *,date_format(date, '%W, %M %e, %Y') as nicedate, date_format(date, '%l:%i %p') as nicetime from messages where thread_id=0 and approved=1 order by date desc limit $limit, $maxcount") or &dbdie; $rv = $sth->execute; while ($f = $sth->fetchrow_hashref) { my($asth) = $dbh->prepare("select count(*) from messages where thread_id=$f->{id}"); $rv = $asth->execute; my($r) = $asth->fetchrow_array; my($responses); if ($r == 1) { $responses = "1 comment"; } elsif ($r > 1) { $responses = "$r comments"; } else { $responses = "0 comments"; } # if ($f->{nicedate} ne $today) { # if ($today ne "") { # print qq(
Dateline: $f->{nicedate}
\n); # $today = $f->{nicedate}; # } print qq(