$opening_hours = $_POST['ophours']; $closing_hours = $_POST['clhours']; $room = $_POST['roomnum']; $max_cap = $_POST['maxcap']; // start session which may be needed later // start it now because it must go before headers session_start(); // get database handle $db = db_connect(); try { // check forms filled in if (!filled_out($_POST)) { throw new Exception('You have not filled the form out correctly. Please go back and try again.'); } // attempt to register // this function can also throw an exception addCompany($db, $company, $date); addBranch($db, $company, $branch, $type, $opening_hours, $closing_hours, $longitude, $latitude); addRoom($db, $company, $branch, $room, $max_cap); // send to the main page $url = 'index.php?page=addsuccess'; // clean buffer ob_end_clean(); // go to the header header("Location: {$url}"); exit; } catch (Exception $e) { // print error echo $e->getMessage(); exit; }
} } else { if ($_GET['action'] == addRoomType && $_SESSION['access'] >= 50) { //if the user is adding the room, then add it if (isset($_POST['addRoomType'])) { $roomType = new RoomType(); addRoomType($roomType); } else { addRoomTypeForm(); } } else { if ($_GET['action'] == addRoom && $_SESSION['access'] >= 50) { $room = new Room(); //if the user is adding the room, then add it if (isset($_POST['addRoom'])) { addRoom($room); } else { addRoomForm(); } } else { if ($_GET['action'] == removeRoomType && $_SESSION['access'] >= 50) { //get the client ID and remove that $roomType = new RoomType($_GET['roomTypeID']); removeRoomType($roomType); } else { if ($_GET['action'] == removeRoomLocation && $_SESSION['access'] >= 50) { //get the client ID and remove that $location = new Location($_GET['locationID']); removeRoomLocation($location); } else { if ($_GET['action'] == removeRoom && $_SESSION['access'] >= 50) {
session_start(); if (!isset($_SESSION['SESS_EMAIL'])) { die("login first"); } include_once "../db_conx.php"; if ($_POST['toDo'] == "logOff") { session_destroy(); } else { if ($_POST['toDo'] == "displayRooms") { displayRooms(); } elseif ($_POST['toDo'] == "deleteRoom") { deleteRoom($_POST['roomId']); } elseif ($_POST['toDo'] == "updateRoom") { updateRoom(); } elseif ($_POST['toDo'] == "addRoom") { addRoom(); } elseif ($_POST['toDo'] == "displaySubjects") { displaySubjects(); } elseif ($_POST['toDo'] == "updateSubject") { updateSubject(); } elseif ($_POST['toDo'] == "deleteSubject") { deleteSubject($_POST['subId']); } elseif ($_POST['toDo'] == "addSubject") { addSubject(); } elseif ($_POST['toDo'] == "displayBatches") { displayBatches(); } elseif ($_POST['toDo'] == "addBatch") { addBatch(); } elseif ($_POST['toDo'] == "updateBatch") { updateBatch(); } elseif ($_POST['toDo'] == "deleteBatch") {