From: Jérôme Benoit Date: Tue, 16 Jan 2018 20:32:27 +0000 (+0100) Subject: Proper handling of authenticated state on important pages. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f78b341761ca9547a4a73b3e27814946434cb254;p=Project_webapp.git Proper handling of authenticated state on important pages. Signed-off-by: Jérôme Benoit --- diff --git a/includes/account.php b/includes/account.php index dc25449..9e725c3 100644 --- a/includes/account.php +++ b/includes/account.php @@ -3,6 +3,7 @@ global $is_logged_in; if (!$is_logged_in) { echo "Please login first."; redirect("index.php?page=login", 2); + exit(); } ?> diff --git a/includes/formbooking.php b/includes/formbooking.php index f1a5fe9..8df025e 100644 --- a/includes/formbooking.php +++ b/includes/formbooking.php @@ -28,7 +28,7 @@ if (!$form_return_flight) { $input_failure = true; } -if (!$input_failure && !empty($form_nb_place) && !empty($form_class_name)) { +if (!$input_failure && $is_logged_in && !empty($form_nb_place) && !empty($form_class_name)) { global $connection; $client_id = get_client_id($_SESSION['email']); $nb_booked = nb_booked($client_id, $form_flight_id); @@ -52,7 +52,7 @@ if (!$input_failure && !empty($form_nb_place) && !empty($form_class_name)) { $rows = $connection->get_result_array(); $connection->close_prepared_query(); foreach ($rows as $row) { - echo "(Simulation de paiement d'une réservation)
" + echo "(Simulation de paiement d'une réservation)
"; echo "Vous avez réservé et payé " . $form_nb_place . " place(s) sur le vol " .$form_flight_id . " au départ de " . $row['VilleD']. " à " . $row['DateD'] . " arrivant à " . $row['VilleA'] . " à " . $row['DateA'] . " pour un montant de " . $form_place_price * $form_nb_place . "€.
"; @@ -64,6 +64,8 @@ if (!$input_failure && !empty($form_nb_place) && !empty($form_class_name)) { } else { redirect("index.php?page=reservations", 3); } +} else { + echo "Make an error message.
"; } ?> diff --git a/includes/reservations.php b/includes/reservations.php index 79ded0e..44208ba 100644 --- a/includes/reservations.php +++ b/includes/reservations.php @@ -3,6 +3,7 @@ global $is_logged_in; if (!$is_logged_in) { echo "Please login first."; redirect("index.php?page=login", 2); + exit(); } ?>

Mes réservations