|
|
|
@ -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'])){
|
|
|
|
|
$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();
|
|
|
|
|
|
|
|
|
|