Commentaire code
This commit is contained in:
parent
6e0465379e
commit
0d256c60ef
@ -1,73 +1,81 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once("../connexionBD.php");
|
||||
require_once("../ressources/trajet.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
$mail = $_SESSION['mail'];
|
||||
if (!(isset($_POST['lieu_depart']) && isset($_POST['lieu_arrivee']) && isset($_POST['date_heure']))){
|
||||
header('Location: ../tableauBord/tableauBord.php');
|
||||
exit();
|
||||
}
|
||||
if (isset($_POST['lieu_depart']) && isset($_POST['lieu_arrivee']) && isset($_POST['date_heure'])) {
|
||||
$source = $_POST['lieu_depart'];
|
||||
$dest = $_POST['lieu_arrivee'];
|
||||
$date_depart = $_POST['date_heure'];
|
||||
if ($date_depart < date('Y-m-d')){
|
||||
echo "Erreur date</br>";
|
||||
echo "<a href='../tableauBord/tableauBord.php'>Retour vers le tableau de bord</a>";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$result = pg_query_params($db, "(SELECT DISTINCT ut.login, ta.codetrajet, ta.datedepart FROM ville v, traverser tr, utilisateur ut, trajet ta WHERE DATE(ta.datedepart) = DATE($3) AND ta.estannule = false AND ta.codetrajet = tr.codetrajet AND ta.mailproposition = ut.mail AND tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.numeroetape = (SELECT MIN(numeroetape) FROM traverser WHERE LOWER(nomVille) = LOWER($1)))
|
||||
INTERSECT (SELECT DISTINCT ut.login, ta.codetrajet, ta.datedepart FROM ville v, traverser tr, utilisateur ut, trajet ta WHERE DATE(ta.datedepart) = DATE($3) AND ta.estannule = false AND ta.codetrajet = tr.codetrajet AND ta.mailproposition = ut.mail AND tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.numeroetape = (SELECT MAX(numeroetape) FROM traverser WHERE LOWER(nomVille) = LOWER($2)));", array($source, $dest, $date_depart));
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="liste_trajet.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Liste des trajets</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require_once("../ressources/navbarhtml.php");
|
||||
?>
|
||||
<div id="container">
|
||||
<div id="entete">
|
||||
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour" src="../ressources/image/return.png"
|
||||
alt="Bouton retour"></a>
|
||||
<h1 class="float" id="titre">Liste des trajets</h1>
|
||||
<br>
|
||||
<h2>Trajets recherchés : <?php echo $source . " vers " . $dest; ?></h2>
|
||||
</div>
|
||||
<div id="liste">
|
||||
<table>
|
||||
<?php
|
||||
while ($row = pg_fetch_array($result)) {
|
||||
$codetrajet = $row['codetrajet'];
|
||||
$login = $row['login'];
|
||||
$source = getDepart($db, $codetrajet);
|
||||
$dest = getFin($db, $codetrajet);
|
||||
$date_depart = $row['datedepart'];
|
||||
if (checkPlacesVoiture($db, $codetrajet) && $date_depart >= date('Y-m-d H:i:s')){
|
||||
echo "<tr><td class='ligne'><hr class='separation'/></td><td class='info'>";
|
||||
echo "<p>$date_depart - $source vers $dest proposé par : $login</p></td>";
|
||||
echo "<td><a href='reserver.php?codetrajet=$codetrajet'>Réserver</a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
//Importation des fichiers necessaires
|
||||
|
||||
require_once("../connexionBD.php");
|
||||
require_once("../ressources/trajet.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
$mail = $_SESSION['mail'];
|
||||
if (!(isset($_POST['lieu_depart']) && isset($_POST['lieu_arrivee']) && isset($_POST['date_heure']))){
|
||||
header('Location: ../tableauBord/tableauBord.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_POST['lieu_depart']) && isset($_POST['lieu_arrivee']) && isset($_POST['date_heure'])) {
|
||||
$source = $_POST['lieu_depart']; //Recuperation des valeurs passé par le form
|
||||
$dest = $_POST['lieu_arrivee'];
|
||||
$date_depart = $_POST['date_heure'];
|
||||
if ($date_depart < date('Y-m-d')){ //Verification de date
|
||||
echo "Erreur date</br>";
|
||||
echo "<a href='../tableauBord/tableauBord.php'>Retour vers le tableau de bord</a>";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//Requete de selection des trajets a affiché
|
||||
|
||||
$result = pg_query_params($db, "(SELECT DISTINCT ut.login, ta.codetrajet, ta.datedepart FROM ville v, traverser tr, utilisateur ut, trajet ta WHERE DATE(ta.datedepart) = DATE($3) AND ta.estannule = false AND ta.codetrajet = tr.codetrajet AND ta.mailproposition = ut.mail AND tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.numeroetape = (SELECT MIN(numeroetape) FROM traverser WHERE LOWER(nomVille) = LOWER($1)))
|
||||
INTERSECT (SELECT DISTINCT ut.login, ta.codetrajet, ta.datedepart FROM ville v, traverser tr, utilisateur ut, trajet ta WHERE DATE(ta.datedepart) = DATE($3) AND ta.estannule = false AND ta.codetrajet = tr.codetrajet AND ta.mailproposition = ut.mail AND tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.numeroetape = (SELECT MAX(numeroetape) FROM traverser WHERE LOWER(nomVille) = LOWER($2)));", array($source, $dest, $date_depart));
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="liste_trajet.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Liste des trajets</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require_once("../ressources/navbarhtml.php");
|
||||
?>
|
||||
<div id="container">
|
||||
<div id="entete"> <--Entete-->
|
||||
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour" src="../ressources/image/return.png"
|
||||
alt="Bouton retour"></a>
|
||||
<h1 class="float" id="titre">Liste des trajets</h1>
|
||||
<br>
|
||||
<h2>Trajets recherchés : <?php echo $source . " vers " . $dest; ?></h2>
|
||||
</div>
|
||||
<div id="liste">
|
||||
<table>
|
||||
<?php
|
||||
while ($row = pg_fetch_array($result)) { //Recuperation des resultats de la requete
|
||||
$codetrajet = $row['codetrajet'];
|
||||
$login = $row['login'];
|
||||
$source = getDepart($db, $codetrajet);
|
||||
$dest = getFin($db, $codetrajet);
|
||||
$date_depart = $row['datedepart'];
|
||||
if (checkPlacesVoiture($db, $codetrajet) && $date_depart >= date('Y-m-d H:i:s')){ //Affichage des resultats sous forme de tableau
|
||||
echo "<tr><td class='ligne'><hr class='separation'/></td><td class='info'>";
|
||||
echo "<p>$date_depart - $source vers $dest proposé par : $login</p></td>";
|
||||
echo "<td><a href='reserver.php?codetrajet=$codetrajet'>Réserver</a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user