include("phpinc/gbconnect.inc");
include("phpinc/gbsaveentry.inc");
?>
ExodusIRC Guestbook
if(!empty($PostNewForm))
{
include("phpinc/gb_postform.inc");
}
else
{
if(!empty($SaveEntryForm))
{
gbsaveentry($nick, $email, $www, $text, $REMOTE_ADDR);
}
if(!($conn = gbconnect()))
{
echo ("
Error connecting to database!\n");
exit;
}
// query with sort on data and then
// span rows here
$query = "select * from entries;";
if(!($result=mysql_query($query,$conn)))
{
mysql_close($conn);
exit;
}
$numrows=mysql_num_rows($result);
if($numrows < 1)
{
mysql_close($conn);
exit;
}
if( ($data=mysql_fetch_array($result, MYSQL_ASSOC)) )
{
echo ("\n");
// generate table rows
do
{
echo ("\n");
// display rows here..
printf("Posted by %s%s on " . $data['date'] . " at " . $data['time'] . "\n", ($data['nick']) ? $data['nick']:"Chicken-shit", ($data['host']) ? " (" . $data['host'] . ")" : '');
echo("" . $data['text'] . "\n");
if($data['www'] || $data['email'])
echo(" \n");
$comma_req = 0;
if($data['email'])
{
echo("E-Mail: " . $data['email'] . "\n");
$comma_req = 1;
}
if($data['www'])
{
if($comma_req == 1)
echo (", \n");
echo("URL: " . $data['www'] . "\n");
}
echo(" \n");
echo (" |
");
} while(($data=mysql_fetch_array($result, MYSQL_ASSOC)));
echo ("
\n");
}
mysql_close($conn);
}
?>