$rows = $connection->get_result_array();
$connection->close_prepared_query();
foreach ($rows as $row) {
+ echo "(Simulation de paiement d'une réservation) <br>"
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 . "€. <br>";
if (!$form_email) {
echo "The email is not valid. <br>";
+ 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)) {
redirect("index.php?page=register", 3);
}
} else {
- // didn't authenticate, go back to login form
- echo "Fail to authenticate. <br>";
+ // didn't authenticate for unknown reason, go back to login form
+ echo "Fail to authenticate for unknown reason. <br>";
redirect("index.php?page=login", 3);
}
$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. <br>" ;
- $error_numstreet = true;
+ $input_failure = true;
}
if (!$form_postalcode) {
echo "The postal code is not valid. <br>";
- $error_postalcode = true;
+ $input_failure = true;
}
if (!$form_email) {
echo "The email is not valid. <br>";
- $error_email = true;
+ $input_failure = true;
}
if (strcmp($form_password, $form_confirmpassword) !== 0) {
echo "Password do not match. <br>";
- $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);
<input type="password" minlength="8" size="15" name="confirmpassword" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*" title="Doit contenir 8 caractères minimum dont une majuscule, une minuscule et un chiffre" required/>
<input type="submit" value="Valider">
</form>
+
+<p> * : Champs obligatoire. </p>
return $this->connection;
}
+ /**
+ * [__destruct description]
+ */
/* public function __destruct()
{
$this->close();
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();
return $rt_val;
}
+ /**
+ * [get_result_array description]
+ * @return [type] [description]
+ */
public function get_result_array()
{
$row = $this->current_result->fetch_array();
<?php
+/**
+ * [is_post_request description]
+ * @return boolean [description]
+ */
function is_post_request()
{
if (filter_input(INPUT_SERVER, 'REQUEST_METHOD') === 'POST') {
}
}
+/**
+ * [is_get_request description]
+ * @return boolean [description]
+ */
function is_get_request()
{
if (filter_input(INPUT_SERVER, 'REQUEST_METHOD') === 'GET') {
}
}
+/**
+ * [chk_account description]
+ * @param [type] $email [description]
+ * @return [type] [description]
+ */
function chk_account($email)
{
global $connection;
}
}
+/**
+ * [chk_password description]
+ * @param [type] $email [description]
+ * @param [type] $password [description]
+ * @return [type] [description]
+ */
function chk_password($email, $password)
{
global $connection;
}
}
+/**
+ * [get_client_id description]
+ * @param [type] $email [description]
+ * @return [type] [description]
+ */
function get_client_id($email)
{
global $connection;
return $row[0][0];
}
+/**
+ * [nb_booked description]
+ * @param [type] $client_id [description]
+ * @param [type] $flight_id [description]
+ * @return [type] [description]
+ */
function nb_booked($client_id, $flight_id)
{
global $connection;
return $row[0][0];
}
+/**
+ * [chk_logged_in description]
+ * @return [type] [description]
+ */
function chk_logged_in()
{
if (isset($_SESSION['email']) && isset($_SESSION['IP_address'])) {
}
}
+/**
+ * [redirect description]
+ * @param [type] $url [description]
+ * @param [type] $delay [description]
+ * @return [type] [description]
+ */
function redirect($url, $delay)
{
header("refresh:$delay; url=$url");