#!/usr/bin/perl
use strict;
#use lib 'C:\Inetpub\wwwroot\Sites\asp\echoingw\members\login.';
use lib '.';
use MyRss;
# 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) = 25;
&do_header($maintitle);
my($today) = "";
$count = 0;
$sth = $dbh->prepare("select *,date_format(date, '%a, %d %b %Y %H:%I:%S EST') as nicedate from messages where thread_id=0 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";
}
# Convert hard returns to line returns in post.
$f->{message} =~ s/\r/
/g;
# Stip all HTML Tags and convert to &alt characters.
$f->{message} =~ s/</g;
$f->{message} =~ s/>/g;
# Convert
tag back to HTML.
$f->{message} =~ s/<br/
{message} =~ s/>br/
{message} =~ s/\[i\]/\/g;
$f->{message} =~ s/\[\/i\]/\<\/i>/g;
# Bold
$f->{message} =~ s/\[b\]/\/g;
$f->{message} =~ s/\[\/b\]/\<\/b>/g;
# Underline
$f->{message}=~ s/\[u\]/\/g;
$f->{message} =~ s/\[\/u\]/\<\/u>/g;
# Lists
$f->{message}=~ s/\[ul\]/\