rendered paste body<?php
session_start();
$main_root_path = "./../includes/";
include($main_root_path . 'authentication.inc');
include($main_root_path . 'dbconnect.inc');
// Connect to a authenticated session or relocate to logout.php
sessionAuthenticate();
if(!empty($title)) {
$title = addslashes($title);
$user = addslashes($user);
$message = addslashes($message);
$date = date("F j, Y");
$date2 = mktime();
$sql = "INSERT INTO mynews (id, title, user, message, date) VALUES ('NULL', '$title','$user','$message','$date')";
$query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error());
echo "Database Updated.";
} else {
?>
<form name="news" method="post" action="<?php echo $PHP_SELF; ?>">
<p>Please fill out all of the following fields:</p>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="117">News Title:</td>
<td width="577">
<font size="1">
<input type="text" name="title" size="50">
</font>
</td>
</tr>
<tr>
<td width="117">Username:</td>
<td width="577">
<font size="1">
<input type="text" name="user" size="50">
</font>
</td>
</tr>
<tr>
<td width="117">Message:</td>
<td width="577">
<font size="1">
<textarea name="message" rows=10 cols=43></textarea>
</font>
</td>
</tr>
</table>
<p>
<font size="1">
<input type="submit" name="Submit" value="Submit"></font>
</p>
</form> <?php
}
?>