<?php
PRINT "<HTML>";
PRINT "<HEAD>";
PRINT "<TITLE>Pauls Graffiti</TITLE>";
PRINT "</HEAD>";

PRINT '<BODY BGCOLOR="#AABB44" TEXT="#000000">';

PRINT "<CENTER>";

PRINT "<FONT SIZE='7'><B>Wrighton's Graffiti</B></FONT><BR>";

PRINT '<FONT SIZE="4"><B>Messages from the public</B></FONT><BR>';
PRINT "</CENTER>";

PRINT '<P><HR WIDTH="80%" ALIGN="CENTER"><P>';

print '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
print '  <tbody>';
print '    <tr>';
print '      <td valign="left" width="140" align="left">';

print '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
print ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
 WIDTH=120 HEIGHT=42>';
print '<PARAM NAME=movie VALUE="flipper.swf?tarframe=_self&exbackground=CC8833&makenavfield0=Home&makenavurl0=http://www.wrightons.info&makenavfield1=Contact Us&makenavurl1=mailto:Enquiries@wrightons.net">';
print '<PARAM NAME=loop VALUE=false>';
print '<PARAM NAME=menu VALUE=false>';
print '<PARAM NAME=quality VALUE=high>';
print '<PARAM NAME=scale VALUE=noborder>';
print '<PARAM NAME=salign VALUE=LT>';
print '<PARAM NAME=wmode VALUE=transparent>';
print '<PARAM NAME=bgcolor VALUE=#BBCCEE>';

print '<EMBED src="flipper.swf?tarframe=_self&exbackground=CC8833&makenavfield0=Home&makenavurl0=http://www.wrightons.info&makenavfield1=Contact Us&makenavurl1=mailto:Enquiries@wrightons.net" loop=false menu=false quality=high scale=noborder salign=LT wmode=transparent bgcolor=#BBCCEE  WIDTH=120 HEIGHT=42 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>';

print '</OBJECT>';

print '<a href="http://www.guistuff.com/"><img border="0" src="http://www.guistuff.com/images/11dot.gif" width="1" height="1"></a>';

print '</td>';
print '<td valign="center" width="70%"';
PRINT "<P>";
PRINT "<P>";
PRINT '<FONT SIZE="4"><B>Most recent entries will be first.</B></FONT>';

print '</td>';
print '  </tr>';
print '  </tbody>';
print '</table>';


include("dbup.php");

$result = mysql_query( "SELECT DATE_FORMAT(entered, '%d-%m-%Y') AS entered, heading, contents FROM journal
                        ORDER BY id DESC",$db)
or die("Query failed with error ".mysql_error());
$xml_output  = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<entries>\n";

for($x = 0 ; $x < mysql_num_rows($result) ; $x++){
    $row = mysql_fetch_assoc($result);
    $xml_output .=  "\t<entry>\n";
    $xml_output .= "\t\t<date>" . $row['entered'] . "</date>\n";
    $xml_output .= "\t\t<heading><FONT SIZE='4'><B><I> - " . $row['heading'] . "</text></B></I></FONT><BR>\n";
        // Escaping illegal characters
        $row['contents'] = str_replace("&", "&", $row['contents']);
        $row['contents'] = str_replace("<", "<", $row['contents']);
        $row['contents'] = str_replace(">", "&gt;", $row['contents']);
        $row['contents'] = str_replace("\"", "&quot;", $row['contents']);
$row['contents'] = nl2br($row['contents']);
    $xml_output .= "\t\t<contents><FONT SIZE='4'>" . $row['contents'] . "</text></FONT><P>\n";
    $xml_output .= "\t</entry>\n";
}

$xml_output .= "</entries>";

echo $xml_output; 
PRINT "<P>";
PRINT '<FONT SIZE="4"><B>Thank you for reading or scribbling!</B></FONT><P>';

PRINT '<P><HR WIDTH="70%" ALIGN="CENTER"><P>';


PRINT "</BODY>";
PRINT "</HTML>";
?>