From: Jérôme Benoit Date: Tue, 16 Jan 2018 19:44:36 +0000 (+0100) Subject: Misc code cleanups and comment. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1f4879b9c1089889355c57ce1e2dda1d3f032872;p=Project_webapp.git Misc code cleanups and comment. Signed-off-by: Jérôme Benoit --- diff --git a/includes/formbooking.php b/includes/formbooking.php index 373e18b..f1a5fe9 100644 --- a/includes/formbooking.php +++ b/includes/formbooking.php @@ -52,6 +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 "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 . "€.
"; diff --git a/includes/formlogin.php b/includes/formlogin.php index ed17f80..b07ad4e 100644 --- a/includes/formlogin.php +++ b/includes/formlogin.php @@ -4,6 +4,7 @@ $form_password = filter_input(INPUT_POST, "password", FILTER_SANITIZE_STRING); if (!$form_email) { echo "The email is not valid.
"; + redirect("index.php?page=login", 3); } elseif (isset($form_email) && isset($form_password)) { if (chk_account($form_email)) { if (chk_password($form_email, $form_password)) { @@ -24,7 +25,7 @@ if (!$form_email) { redirect("index.php?page=register", 3); } } else { - // didn't authenticate, go back to login form - echo "Fail to authenticate.
"; + // didn't authenticate for unknown reason, go back to login form + echo "Fail to authenticate for unknown reason.
"; redirect("index.php?page=login", 3); } diff --git a/includes/formregister.php b/includes/formregister.php index 6cb9223..4abaa50 100644 --- a/includes/formregister.php +++ b/includes/formregister.php @@ -9,31 +9,28 @@ $form_email = filter_input(INPUT_POST, "email", FILTER_VALIDATE_EMAIL); $form_password = filter_input(INPUT_POST, "password", FILTER_SANITIZE_STRING); $form_confirmpassword = filter_input(INPUT_POST, "confirmpassword", FILTER_SANITIZE_STRING); -$error_numstreet = false; -$error_postalcode = false; -$error_email = false; -$error_password = false; +$input_failure = false; if (!$form_numstreet) { echo "The street number is not valid.
" ; - $error_numstreet = true; + $input_failure = true; } if (!$form_postalcode) { echo "The postal code is not valid.
"; - $error_postalcode = true; + $input_failure = true; } if (!$form_email) { echo "The email is not valid.
"; - $error_email = true; + $input_failure = true; } if (strcmp($form_password, $form_confirmpassword) !== 0) { echo "Password do not match.
"; - $error_password = true; + $input_failure = true; } if (!empty($form_name) && !empty($form_firstname) && !empty($form_numstreet) && !empty($form_street) && !empty($form_postalcode) && !empty($form_city) && !empty($form_email) && !empty($form_password) && - !$error_numstreet && !$error_postalcode && !$error_email && !$error_password) { + !$input_failure) { if (!chk_account($form_email)) { global $connection; $hashed_password = password_hash($form_password, PASSWORD_DEFAULT); diff --git a/includes/register.php b/includes/register.php index 8db3bc0..5c1a107 100644 --- a/includes/register.php +++ b/includes/register.php @@ -22,3 +22,5 @@ + +

* : Champs obligatoire.

diff --git a/lib/db.php b/lib/db.php index cd9b082..bcbf5ae 100644 --- a/lib/db.php +++ b/lib/db.php @@ -31,6 +31,9 @@ class CustomDB return $this->connection; } + /** + * [__destruct description] + */ /* public function __destruct() { $this->close(); @@ -106,6 +109,10 @@ class CustomDB return $rt_val; } + /** + * [get_pquery_result description] + * @return [type] [description] + */ public function get_pquery_result() { $rt_val = $this->current_result = $this->current_stmt->get_result(); @@ -115,6 +122,10 @@ class CustomDB return $rt_val; } + /** + * [get_result_array description] + * @return [type] [description] + */ public function get_result_array() { $row = $this->current_result->fetch_array(); diff --git a/lib/utils.php b/lib/utils.php index 47c8bda..9955458 100644 --- a/lib/utils.php +++ b/lib/utils.php @@ -1,5 +1,9 @@