<?php
require_once("includes/SQLConnect.php");
require_once("includes/user_data.php");

if(isset($_POST['topic']) && strlen($_POST['topic'])>0){
	
	if(mysql_query("INSERT INTO Forum_Topics(user_ID,topic) VALUES(".$user_data['ID'].",'".mysql_real_escape_string($_POST['topic'])."')"))
		header("Location:forum_view_topic.php?ID=".mysql_insert_id()."&new_topic=true&success=Topic created successfully, be the first to comment!");
	else
		$warning = "You've already posted that topic.";
}

include_once("includes/header.php");
?>

<h2>Start a New Forum Topic</h2>

<form action="forum_create_topic.php" method="POST">
	<label>Topic:</label>
	
	<input type="text" name="topic" class='large'>
	
	<input type="submit" class="submit" value="Create Topic">

</form>

<?php
include_once("includes/footer.php");
?>