#! /usr/bin/perl
use DBI;
use CGI;
do "lock.pl";
$q = new CGI;
$from = $q->param("from");
if ($from eq "")
{
$from = 0;
}
$maxPerPage = 20;
#push(@INC,"e:\\html\\test\\cgi-bin");
require "myvars.pl";
print "Content-type: text/html\n\n";
IncludeFile("newstemplate1.html");
if (my $dbh = DBI->connect( $dbName, $dbUser, $dbPw))
{
if ($from == 0)
{
open(FH, ">newscopy.html");
lock(FH);
}
$sth = $dbh->prepare("select count(*) from news where theme != 'WAP only (for www.wapterror.de)' and theme != 'Kloppi'");
$results = $sth->execute() or print "SQL-Error: $DBI::errstr\n";
if (@result = $sth->fetchrow_array )
{
$newsCount = $result[0];
}
$sth->finish();
$sth = $dbh->prepare("select title, text, date, comment, c, theme, user from news where theme != 'WAP only (for www.wapterror.de)' and theme != 'Kloppi' order by c desc limit $from, $maxPerPage");
$results = $sth->execute() or print "SQL-Error: $DBI::errstr\n";
if ($newsCount > $from + $maxPerPage)
{
print "View older news
";
}
else
{
print "
";
}
if ($from != 0)
{
print "View more recent news
";
}
else
{
print "
";
}
print "
";
PrintTableHeader();
my $date = "";
while (@result = $sth->fetchrow_array )
{
if ($date ne $result[2])
{
$date = $result[2];
print "
View Comments |
Add Comment |