Commentaire code
This commit is contained in:
parent
77796e4df8
commit
6e0465379e
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
//Declaration de fonction
|
||||||
|
|
||||||
function verifierTrajet($db, $mail, $codetrajet){
|
function verifierTrajet($db, $mail, $codetrajet){
|
||||||
$trajet = getTrajet($db, $codetrajet);
|
$trajet = getTrajet($db, $codetrajet);
|
||||||
if (!$trajet){
|
if (!$trajet){
|
||||||
@ -8,21 +11,25 @@ function verifierTrajet($db, $mail, $codetrajet){
|
|||||||
return checkReservations($db, $mail, $codetrajet) && checkDatesReserve($db, $mail, $trajet['datedepart']) && checkPlacesVoiture($db, $codetrajet) && strcmp($trajet['mailproposition'], $mail) != 0;
|
return checkReservations($db, $mail, $codetrajet) && checkDatesReserve($db, $mail, $trajet['datedepart']) && checkPlacesVoiture($db, $codetrajet) && strcmp($trajet['mailproposition'], $mail) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Importation des fichiers necessaire
|
||||||
|
|
||||||
require_once("../connexionBD.php");
|
require_once("../connexionBD.php");
|
||||||
require_once("../ressources/trajet.php");
|
require_once("../ressources/trajet.php");
|
||||||
|
|
||||||
if (!isset($_SESSION['mail'])) {
|
if (!isset($_SESSION['mail'])) { // Test si connecté ou non
|
||||||
header('Location: ../index.php');
|
header('Location: ../index.php');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail = $_SESSION['mail'];
|
$mail = $_SESSION['mail'];
|
||||||
|
|
||||||
if (isset($_GET['codetrajet'])){
|
if (isset($_GET['codetrajet'])){
|
||||||
$codetrajet = $_GET['codetrajet'];
|
$codetrajet = $_GET['codetrajet'];
|
||||||
if (verifierTrajet($db, $mail, $codetrajet)){
|
if (verifierTrajet($db, $mail, $codetrajet)){ // Test si place dispo et si on peut reserver
|
||||||
reserver($db, $mail, $codetrajet);
|
reserver($db, $mail, $codetrajet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: ../tableauBord/tableauBord.php');
|
header('Location: ../tableauBord/tableauBord.php');
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user