rendered paste body<script type='text/javascript'>
function AddCode(){
document.form.form.message.Text += "[code] [/code]";
}
</script>
<?php
$file = "connect.php";
if (!$file)
{
die ('Cannot find file: ".$file."');
}else{
include("$file");
// start the error checks + field empty + data insertion
$submit = $_POST['submit'];
$author = $_POST['author'];
$topic = $_POST['topic'];
$msg = $_POST['message'];
$uid = $_POST['uid'];
$on = date("m/d/y");
if (isset($submit)) {
if ($topic == NULL) {
die ('Error: You did not enter a topic.');
}
if ($msg == NULL) {
die ('Error: You did not enter a message.');
}else{
$insert = "INSERT INTO topics VALUES ('','$uid','$topic','$author','$msg','$on')";
mysql_query($insert);
$body = "Your topic is now being posted. <a href='main.php'>Return to the forum, and find your post!";
echo $body;
}
}else{
$rand = rand(0,1000);
echo "
<center>
* type <code> </code> for a tutorial... <a href='javascript:AddCode()'>Add Code</a>
<form name='form' action='newtopic.php' method='post'>
<input type='hidden' name='uid' value='".$_GET['id']."'>
<table>
<tr>
<td>Topic:</td>
<td><input type='text' name='topic' value=''></td>
</tr>
<tr>
<td>Name:</td>
<td><input type='text' name='author' value='author$rand' readonly></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea cols='30' rows='5' name='message'></textarea></td>
</tr>
<tr>
<td><input type='submit' name='submit' value='Create Topic'></td>
</tr>
</table>
</form>
</center>";
}
}
?>