Commentaire code

This commit is contained in:
PALAFFRE Raphaël 2019-05-25 08:46:28 +00:00
parent 77796e4df8
commit 6e0465379e

View File

@ -1,5 +1,8 @@
<?php
session_start();
//Declaration de fonction
function verifierTrajet($db, $mail, $codetrajet){
$trajet = getTrajet($db, $codetrajet);
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;
}
//Importation des fichiers necessaire
require_once("../connexionBD.php");
require_once("../ressources/trajet.php");
if (!isset($_SESSION['mail'])) {
if (!isset($_SESSION['mail'])) { // Test si connecté ou non
header('Location: ../index.php');
exit();
}
$mail = $_SESSION['mail'];
if (isset($_GET['codetrajet'])){
if (isset($_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);
}
}
header('Location: ../tableauBord/tableauBord.php');
exit();