#!/usr/bin/perl use CGI; use DBD::mysql; $driver = "mysql"; $hostname = "www.mg2.org"; $port = 3306; $user = "warch"; $pass = "k33p1tr33l"; $table = "words_archive"; $database = "wordsarch"; $dsn = "DBI:$driver:database=$database;host=$hostname;port=$port"; $dbh = DBI->connect($dsn, $user, $pass); $query = new CGI; $font = ""; $blueFont = ""; $whiteFont = ""; $greyFont = ""; $fontBig = ""; $textFont = ""; print "Content-Type: text/html\n\n"; print < words.mg2.org
archive feedback log in staff
EOF print "
"; $sth = $dbh->prepare("SELECT min(post_id) from $table"); $sth->execute(); while ($return = $sth->fetchrow_arrayref) { $min_id = @$return[0]; } $sth = $dbh->prepare("SELECT max(post_id) from $table"); $sth->execute(); while ($return = $sth->fetchrow_arrayref) { $max_id = @$return[0]; } $cur_id = $max_id; unless (($min_id) && ($max_id)) { $min_id = 1; $max_id = 0; } while ($cur_id >= $min_id) { $sth = $dbh->prepare("SELECT * from $table where post_id = $cur_id"); $sth->execute(); undef(%entry); while ($return = $sth->fetchrow_hashref) { %entry = %$return; } if (%entry) { $entry{'entry'} =~ s/\r\n/
/g; $entry{'entry'} =~ s/ /  /g; $entry{'entry'} =~ s/\t/\ \ \ \ \ \ \ \ /g; print "\n"; print ""; print "
"; print "
"; print ""; print ""; print "
$blueFont$entry{'datestamp'}$greyFont$entry{'subject'}$blueFont$entry{'poster'}
"; print ""; print "
$textFont$entry{'entry'}
"; } --$cur_id; } print "\n";