//Sends success message to session //Shows user success when they are redirected $success_msg = "You Have Successfully Deleted Forum Category!"; $_SESSION['success_msg'] = $success_msg; //Disables auto refresh for debug stuff if ($debug_website == 'TRUE') { echo "<br> - DEBUG SITE ON - <BR>"; } else { //Redirects the user global $websiteUrl, $site_forum_title; $form_redir_link = "{$websiteUrl}{$site_forum_title}/"; // Redirect member to their post header("Location: {$form_redir_link}"); exit; } } else { err_message('Oops. There was an error. 5433228'); die; } } } } } else { // If user is not a site admin then don't let them view this page // Auto Redirect back to the forum global $websiteUrl, $site_forum_title; $form_redir_link = "{$websiteUrl}{$site_forum_title}/"; // Redirect member to their post header("Location: {$form_redir_link}"); exit; }
<?php if (isUserLoggedIn()) { // saving script // get the variables from the URL POST string global $websiteName, $site_forum_main; //Token validation function if (!is_valid_token()) { //Token does not match err_message('Sorry, Tokens do not match! Please go back and try again.'); } else { // Page title $stc_page_title = "{$websiteName} Forum"; // Page Description $stc_page_description = "Welcome to {$websiteName} Forum. Ask questions and get answers from fellow members."; // Run Top of page func style_header_content($stc_page_title, $stc_page_description); // Which database do we use $stc_page_sel = "Forum"; if (isset($_POST['forum_id'])) { $forum_id = $_POST['forum_id']; } else { $forum_id = ""; } if (isset($_POST['forum_post_id'])) { $forum_post_id = $_POST['forum_post_id']; } else { $forum_post_id = ""; } if (isset($_POST['forum_title'])) { $forum_title = $_POST['forum_title'];
function forumEditCatCheck($f_cat, $f_des, $f_id2) { global $mysqli, $db_table_prefix, $load_page_dir, $session_token_num, $debug_website, $websiteUrl, $site_forum_main; // Check to see if mod is updating a forum cat if (isset($_POST['AdminEditCat'])) { $AdminEditCat = $_POST['AdminEditCat']; } else { $AdminEditCat = "FALSE"; } if (isset($_POST['forum_cat_old'])) { $forum_cat_old = $_POST['forum_cat_old']; } else { $forum_cat_old = ""; } if (isset($_POST['forum_cat_new'])) { $forum_cat_new = $_POST['forum_cat_new']; } else { $forum_cat_new = ""; } if (isset($_POST['forum_des_old'])) { $forum_des_old = $_POST['forum_des_old']; } else { $forum_des_old = ""; } if (isset($_POST['forum_des_new'])) { $forum_des_new = $_POST['forum_des_new']; } else { $forum_des_new = ""; } if (isset($_POST['forum_id_edit'])) { $forum_id_edit = $_POST['forum_id_edit']; } else { $forum_id_edit = ""; } if ($AdminEditCat == "TRUE") { //Token validation function if (!is_valid_token()) { //Token does not match err_message('Sorry, Tokens do not match! Please go back and try again.'); die; } else { // Update Database with new cat $stmt = $mysqli->prepare("UPDATE " . $db_table_prefix . "forum_cat SET forum_cat=?, forum_des=? WHERE forum_id=?"); $stmt->bind_param("ssi", $forum_cat_new, $forum_des_new, $forum_id_edit); if ($stmt->execute()) { $stmt->close(); //Sends success message to session //Shows user success when they are redirected $success_msg = "You Have Successfully Updated Forum Cat!"; $_SESSION['success_msg'] = $success_msg; //Disables auto refresh for debug stuff if ($debug_website == 'TRUE') { echo "<br> - DEBUG SITE ON - <BR>"; } else { //Redirects the user global $websiteUrl, $site_forum_cat; $form_redir_link = "{$websiteUrl}{$site_forum_main}"; // Redirect member to their post header("Location: {$form_redir_link}"); exit; } } else { err_message('Oops. There was an error. 5468'); die; } } } else { if (isset($_POST['EditCat'])) { $EditCat = $_POST['EditCat']; } else { $EditCat = "FALSE"; } if (isset($_POST['forum_cat'])) { $forum_cat = $_POST['forum_cat']; } else { $forum_cat = ""; } if (isset($_POST['forum_des'])) { $forum_des = $_POST['forum_des']; } else { $forum_des = ""; } if (isset($_POST['forum_id_edit'])) { $forum_id_edit = $_POST['forum_id_edit']; } else { $forum_id_edit = ""; } // Make sure user has permission to edit this cat if ((userCheckForumAdmin() || userCheckForumMod()) && ($EditCat == "TRUE" && $forum_cat == $f_cat && $f_id2 == $forum_id_edit)) { // Mod or Admin would like to edit a cat // Show edit forum in place of cat echo "<form enctype=\"multipart/form-data\" action=\"\" method=\"POST\" onsubmit=\"submitmystat.disabled = true; return true;\" class='sweetform' >"; // Setup token in form // create multi sessions if (isset($session_token_num)) { $session_token_num = $session_token_num + 1; } else { $session_token_num = "1"; } form_token(); echo "<input name=\"forum_cat_new\" type=\"text\" value=\"{$f_cat}\" style='width:200px;font-family:verdana;font-size:12px;font-weight:bold'><BR>"; echo "<input name=\"forum_des_new\" type=\"text\" value=\"{$f_des}\" style='width:300px;font-family:verdana;font-size:12px;font-weight:normal'>"; echo "<input type=\"hidden\" name=\"forum_cat_old\" value=\"{$f_cat}\" />"; echo "<input type=\"hidden\" name=\"forum_des_old\" value=\"{$f_des}\" />"; echo "<input type=\"hidden\" name=\"forum_id_edit\" value=\"{$f_id2}\" />"; echo "<input type=\"hidden\" name=\"AdminEditCat\" value=\"TRUE\" />"; echo "<input type=\"submit\" value=\"Update\" name=\"Update\" class=\"sweet\" onClick=\"this.value = 'Please Wait....'\" />"; echo "</form>"; } else { global $websiteUrl, $site_forum_cat; echo "<h3><a href='{$websiteUrl}{$site_forum_main}?1=forum_display&2={$f_cat}&3{$f_id2}/' title='{$f_cat}' ALT='{$f_cat}'>{$f_cat}</a></h3>"; echo " - {$f_des}"; } } }