<?php /*
CREATE TABLE `thewall` (
`id` int(11) NOT NULL auto_increment,
`timedate` varchar(15) NOT NULL default '',
`nick` varchar(15) NOT NULL default '',
`msg` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=5 ;
*/
echo "<center><br><br>";
echo "<font class=header>The Grafitti Wall</font><br></center>";
if (isset($_POST['submit_wall'])) {
$query = "INSERT INTO `thewall` ( `id` , `timedate` , `nick` , `msg` ) VALUES ('', '".date('F j, g:i a')."', '".$_SESSION['logged_in_username']."', '".$_POST['text']."')";
mysql_query($query) or die(mysql_error());
echo "msg submited<br><br>";
}
$result = mysql_query("SELECT `id` , `timedate` , `nick` , `msg` FROM `thewall` WHERE 1 ORDER BY `id` DESC LIMIT 0 , 50") or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
echo $row['timedate'] . "<<font class='header'>" . $row['nick'] . "</font>> " . stripslashes(htmlspecialchars($row['msg'])) . "<br>";
}
echo "
<br><br>
<font class=header>Add to the wall</font>
<form method=post>
Text: <input type=text size=50 maxlength=200 name='text'>
<br><br>
<input type=submit name='submit_wall' value='Add to the wall'>
</form>
";
?>
|
|