// Preamble $pageName = "Edit News"; $need = 'auth'; require 'parts/preamble.php'; // Load most of document if (!$userInfo['u_admin']) // no access from non-admin yet bailout ("
You don't have access to this page (yet?). Bug an admin to delete a news post.
"); need ('html sql'); function newsEntrySummary ($it) { need ('date html'); return 'Bad mojo, man. I couldn't talk to the SQL server. It said '$sqlError'.
"; } elseif ($rows === false) { echo "Something bad happened, and MySQL said '$sqlError'. Bug an admin.
"; } elseif (!$rows) { echo 'Your edit was correctly formed, but had no effect on the database. Go fig, huh?
'; } else { echo 'Your edit was processed successfully. Congratulations on your revision of history.:)
'; } } else { $query = 'SELECT n_id, n_date, n_user, n_news FROM news_main' ." WHERE n_id=$newsID"; $entries = sqlReadQuery ($query); if ($entries === null) { echo "Bad mojo, man. I couldn't talk to the SQL server. It said '$sqlError'.
"; } elseif ($entries === false) { echo "Something bad happened, and MySQL said '$sqlError'. Bug an admin.
"; } elseif (count ($entries) == 1) { newsEntryEditor ($entries[0]); } else { echo "This shouldn't even be possible, but there's more than one news entry with ID '$newsID'!
"; } } } else { newsBoxOpen ("All News Postings"); $query = 'SELECT n_id, n_date, n_user, n_news FROM news_main' .' ORDER BY n_date DESC'; $entries = sqlReadQuery ($query); if ($entries && is_array ($entries) && count ($entries)) { tableHeader ("100%"); ?>No news available."; } newsBoxClose (); } ?>