$today = date('z') - $firstday; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $username = "******"; $password = "******"; $hostname = "localhost"; $dbhandle = mysqli_connect($hostname, $username, $password) or die("Impossibile connettersi al server. Contatta il webmaster (Codice C1))"); $selected = mysqli_select_db($dbhandle, "6786_prenotazioni") or die("Errore di connessione al server. Contatta il webmaster (Codice D1)"); try { if (isset($_POST['delbooking'])) { deleteReservation($dbhandle, (int) $_POST['prenid']); } else { if (isset($_POST['newbooking'])) { $last_prenid = makeReservation($dbhandle, $year); $open = 1; } else { updateReservation($dbhandle, (int) $_POST['prenid'], $year); $last_prenid = (int) $_POST['prenid']; } } } catch (Exception $e) { $error = true; $error_message = $e->getMessage(); } } // *************** MAKE RESERVATION ******************************* function makeReservation($dbhandle, $year) { $validData = validate($dbhandle, $year); checkAssertions($dbhandle, $validData, 0, $year); // Retrieve colors $lastColor = mysqli_fetch_array(mysqli_query($dbhandle, "SELECT ID FROM Colori WHERE last IN (SELECT MAX(last) FROM Colori)"))[0];
} // end stuff that is done the first time the form is visited //process the editing form if (isset($_POST['form_token']) && validateTokenField($_POST)) { error_log("will process the edit form"); $informationroom = readFormData(); error_log('social worker id is ' . $informationroom->get_socialWorkerProfileId()); error_log('rmh staff id is ' . $informationroom->get_rmhStaffProfileId()); $beginDate = new DateTime($informationroom->get_beginDate()); $endDate = new DateTime($informationroom->get_endDate()); $formattedBeginDate = $beginDate->format('Y-m-d'); $formattedEndDate = $endDate->format('Y-m-d'); //if ($showResult) if (isset($_POST['Submit'])) { error_log("will call updateReservation"); $ret = updateReservation($informationroom); if ($ret == -1) { echo "Could not update the Room Reservation"; } else { echo "Update was successful"; } } else { if (isset($_POST['Cancel'])) { error_log("will do a cancel"); $ret = cancelReservation($informationroom); if ($ret == -1) { echo "Could not cancel the room reservation"; } else { echo "Reservation cancellation was submitted"; } } else {
Filename: editreservation.php Associated PageIDs: "editreseravtion" Purpose: This page displays information of a specific reservation. It determines which reservation to display through either a GET or POST variable "resid". Known Bugs/Fixes: None */ if (isset($_GET['resid'])) { $resid = $_GET['resid']; } else { if (isset($_POST['resid'])) { $resid = $_POST['resid']; updateReservation($resid, $_POST['startdate'], $_POST['enddate']); } } /* Get the information of this reseravtion, the user, and the equipment involved. */ $reservation = mysql_fetch_assoc(getReservationByID($resid)); $user = mysql_fetch_assoc(getUserByID($reservation['user_id'])); $equipment = mysql_fetch_assoc(getEquipmentByID($reservation['equip_id'])); if ($reservation['mod_status'] == RES_STATUS_CONFIRMED) { $status = "<font color=\"#005500\">Current Status: Confirmed</font>"; } else { if ($reservation['mod_status'] == RES_STATUS_CHECKED_OUT) { $status = "<font color=\"#005500\">Current Status: Checked-Out</font>"; } else { if ($reservation['mod_status'] == RES_STATUS_CHECKED_IN) {