#!/usr/local/bin/perl
#####################################^M
# This script copyright Chris Covert, 2005^M
####################################
use CGI qw(:standard);
use Pg;
use DBI;
use DBD::Pg;
use Date::Simple( ':all');
use DateTime;
my $dt = DateTime->now;
my $dates = $dt->ymd;
my $dt = DateTime->now;
my $dates = $dt->ymd;
my $dlocation;
my $gdlocation;
$whichremark = param('whichstory');
$dbid = 'dbi:Pg:dbname=ffz;host=localhost;port=5432;user=GOBOY';
$blogname = 'Free Fire Zone';
$ipnum = $ENV{REMOTE_ADDR};
my $dbhone= DBI->connect( $dbid ) or die "Not Connect\n";
$sthseven= $dbhone->prepare( " SELECT COUNT(*) FROM pithysayingz ");
$sthseven->execute;
while (@soparts = $sthseven->fetchrow_array()) {
$reccount = @soparts[0];
$whichsaying = int(rand($reccount)+1);
}
print qq[$reccount];
$sthone= $dbhone->prepare( " SELECT * FROM pithysayingz LIMIT $whichsaying ");
$sthone->execute;
while (@sparts = $sthone->fetchrow_array()) {
$saying[$whichsaying]= @sparts[0];
$saying = $saying[$whichsaying];
}
print header;
print qq[];
print qq[];
print qq[
];
print qq[];
$sthtwo= $dbhone->prepare( " SELECT * FROM stories WHERE idnum=? ");
$sthtwo->execute($whichremark);
while (@parts = $sthtwo->fetchrow_array()) {
# $dlocation = $dlocation + 1;
$idnum[0] = @parts[0];
$date[0] = @parts[1];
$category[0] = @parts[2];
$title[0] = @parts[3];
$url[0] = @parts[4];
$author[0] = @parts[5];
$storytext[0] = @parts[6];
$storytext[0] =~ s/\/images\//\/pics\//g;
$diffdays = date($dates) - date($date[0]);
$remarkid = $idnum[0];
if ($diffdays > 5 ) {
&goprintwarning; }
$sthten= $dbhone->prepare( " SELECT * FROM categories WHERE catname =? ");
$sthten->execute($category[0]);
while (@zparts = $sthten->fetchrow_array()) {
$categoryname[0]= @zparts[0];
$categorypic[0]= @zparts[1];
if ($category[0] eq $categoryname[0] ) {
$correctpic = $categorypic[0]; }
}
if ($category[0] == 'MEXICO')
{
exit;
}
print qq[
];
print qq[
$title[$dlocation]];
print qq[
];
print qq[
];
print qq[$date[$dlocation]
by: $author[$dlocation]
];
print qq[
$storytext[0]..
];
print qq[
-----------------------------------------COMMENTS----------------------------------------];
}
$sththree= $dbhone->prepare( " SELECT * FROM comments WHERE storyid=? ");
$sththree->execute($remarkid);
while (@sqparts = $sththree->fetchrow_array()) {
#$gdlocation = 1;
$idnum[$gdlocation] = @sqparts[0];
$date[$gdlocation] = @sqparts[1];
$ucname[$gdlocation] = @sqparts[2];
$ucurl[$gdlocation] = @sqparts[3];
$iplog[$gdlocation] = @sqparts[4];
$ucstorytext[$gdlocation] = @sqparts[5];
$trolltag[$gdlocation] = @sqparts[6];
$numcomment =$numcomment+1;
print qq[
Comment $numcomment by: ];
print qq[
$ucname[$gdlocation]];
print qq[
$ucstorytext[$gdlocation]
];
print qq[
-----------------------------------------COMMENTS----------------------------------------];
print qq[];
$gdlocation++;
}
print qq[
$remarkid];
print qq[
];
print qq[
];
print qq[];
print qq[];
print qq[];
sub goprintwarning {
print qq[