permission & User::CREATE_FORUM) { die('

Sorry, you do not have sufficient privileges to create new ' . 'forums.

'); } // validate incoming values $forum_name = (isset($_POST['forum_name'])) ? trim($_POST['forum_name']) : ''; $forum_desc = (isset($_POST['forum_desc'])) ? trim($_POST['forum_desc']) : ''; // add entry to the database if the form was submitted and the necessary // values were supplied in the form if (isset($_POST['submitted']) && $forum_name && $forum_desc) { $query = sprintf('INSERT INTO %sFORUM (FORUM_NAME, DESCRIPTION) ' . 'VALUES ("%s", "%s")', DB_TBL_PREFIX, mysql_real_escape_string($forum_name, $GLOBALS['DB']), mysql_real_escape_string($forum_desc, $GLOBALS['DB'])); mysql_query($query, $GLOBALS['DB']); // redirect user to list of forums after new record has been stored header('Location: view.php'); } // form was submitted but not all the information was correctly filled in else if (isset($_POST['submitted'])) { $message = '

Not all information was provided. Please correct ' . 'and resubmit.

'; } // generate the form ob_start(); if (isset($message)) { echo $message; } ?>