} else { postResponse("error", $e->errorInfo[2]); } } if ($newAdmin) { changeUserLevel($uName, 'dean'); $_SESSION['logged_in'] = true; $_SESSION['uName'] = $uName; $_SESSION['level'] = "dean"; $_SESSION['fName'] = $_POST['fullName']; $_SESSION['dept'] = $dept_code; postResponse("redirect", $_SESSION['level'] . ".php"); } } if (!empty($_POST['level'])) { changeUserLevel($uName, $_POST['level']); } if (valueCheck('action', 'changeLevel')) { postResponse("updateOpt", "Level Changed"); } else { postResponse("addOpt", "Faculty Added", [$_POST["fullName"], $uName]); } } /** * changeUserLevel() * * Add or remove $user to the admin table with the given $level */ function changeUserLevel($user, $level) { global $db;
else{ $message = "Error: Passwords Don't Match<br><br>"; } } else if($pageid == "adminsaveemail"){ changeUserEmail($userid, $_POST['email']); $message = "User Saved!<br><br>"; } else if($pageid == "adminsavelevel"){ changeUserLevel($userid, $_POST['level']); $message = "User Saved!<br><br>"; } else if($pageid == "adminsavenotes"){ changeUserNotes($userid, $_POST['notes']); $message = "User Saved!<br><br>"; } if($pageid == "edituser" || $pageid == "adminsavepassword" || $pageid == "adminsaveemail" || $pageid == "adminsavelevel"){ $sel = ""; }else{