// Preamble $pageName = "Add News"; $need = 'auth'; require "parts/preamble.php"; // Load most of document need ('boxes html news sql'); $newsText = addSlashes($_REQUEST['newsText']); $mode = $_REQUEST['mode']; $user = $userInfo['u_displayname']; if ($newsText && $mode == "Post") { $query = 'INSERT into news_main (n_date, n_user, n_news) VALUES (' ."NOW(), '$user', '$newsText')"; $rows = sqlWriteQuery ($query); if ($rows === null) { echo '
You suck, butthead.
'; } elseif ($rows === false) { echo 'There was an error in your input. If you don\'t know what it is, I\'m not going to tell you.
'; } else { echo 'Your news item has been processed successfully.
'; } } else { $date = date ('d M Y'); newsBoxOpen (); if ($newsText) { newsBoxTitle ("Latest News (Preview)"); printNews ($date, $user, stripSlashes ($newsText)); } newsBoxTitle ("Post News"); $form = ''; printNews ($date, $user, $form); newsBoxClose (); } ?>