From 9b671fa476a8d6f97e78698d048b0a96f0d7b6e7 Mon Sep 17 00:00:00 2001 From: "remi.biette" Date: Thu, 23 May 2019 13:14:50 +0200 Subject: [PATCH] Tout marche --- WEB/listeTrajetPublie/liste_trajet_publie.php | 10 ++++++++-- WEB/listeTrajetReserve/liste_trajet_reserve.php | 11 ++++++++--- WEB/liste_trajets/reserver.php | 2 +- WEB/ressources/trajet.php | 4 ++-- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/WEB/listeTrajetPublie/liste_trajet_publie.php b/WEB/listeTrajetPublie/liste_trajet_publie.php index 6a4ab08..3080e05 100644 --- a/WEB/listeTrajetPublie/liste_trajet_publie.php +++ b/WEB/listeTrajetPublie/liste_trajet_publie.php @@ -36,16 +36,22 @@ require_once("../ressources/navbarhtml.php");
"; - echo ""; + if ($date <= $row['datearrivee']){ + echo ""; + } + else{ + echo ""; + } echo ""; } ?> diff --git a/WEB/listeTrajetReserve/liste_trajet_reserve.php b/WEB/listeTrajetReserve/liste_trajet_reserve.php index a56399f..2a52dcf 100644 --- a/WEB/listeTrajetReserve/liste_trajet_reserve.php +++ b/WEB/listeTrajetReserve/liste_trajet_reserve.php @@ -34,17 +34,22 @@ require_once("../ressources/navbarhtml.php");

"; echo "

$date_depart - $source vers $dest proposé par : $login

Annuler le trajetAnnuler le trajet

Trajet effectué

"; echo ""; - echo ""; + if ($date <= $row['datearrivee']){ + echo ""; + } + else{ + echo ""; + } echo ""; echo ""; } diff --git a/WEB/liste_trajets/reserver.php b/WEB/liste_trajets/reserver.php index ec40708..a204c9d 100644 --- a/WEB/liste_trajets/reserver.php +++ b/WEB/liste_trajets/reserver.php @@ -5,7 +5,7 @@ function verifierTrajet($db, $mail, $codetrajet){ if (!$trajet){ return false; } - return checkReservations($db, $mail, $codetrajet) && checkPlacesVoiture($db, $codetrajet) && strcmp($mail, $trajet['mailproposition'])!=0; + return checkReservations($db, $mail, $codetrajet) && checkPlacesVoiture($db, $codetrajet) && !strcmp($mail, $trajet['mailproposition']); } require_once("../connexionBD.php"); diff --git a/WEB/ressources/trajet.php b/WEB/ressources/trajet.php index 738e2fa..b7900ab 100644 --- a/WEB/ressources/trajet.php +++ b/WEB/ressources/trajet.php @@ -88,7 +88,7 @@ function checkVoiture($db, $mail, $matricule) function getTrajetsProposes($db, $mail) { - $result = pg_query_params($db, "SELECT COUNT(*) from Trajet WHERE mailProposition = $1 AND estAnnule = false AND datedepart >= current_date;", array($mail)); + $result = pg_query_params($db, "SELECT COUNT(*) from Trajet WHERE mailProposition = $1 AND estAnnule = false AND datearrivee >= $2;", array($mail, date('Y-m-d H:i:s'))); if ($result) { $row = pg_fetch_array($result); return $row[0]; @@ -98,7 +98,7 @@ function getTrajetsProposes($db, $mail) function getTrajetsReserves($db, $mail) { - $result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver re WHERE re.codetrajet = tr.codetrajet AND mailutilisateur = $1 AND estannule = false AND tr.datedepart >= current_timestamp;", array($mail)); + $result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver re WHERE re.codetrajet = tr.codetrajet AND mailutilisateur = $1 AND tr.estannule = false AND re.estannule = false AND tr.datearrivee >= $2;", array($mail, date('Y-m-d H:i:s'))); if ($result) { $row = pg_fetch_array($result); return $row[0];

$date_depart - $source vers $dest proposé par : $login

Annuler la reservationAnnuler la reservation

Trajet effectué

Déposer un avis