Compare commits
5 Commits
master
...
avisTrajet
Author | SHA1 | Date | |
---|---|---|---|
|
3a00f1bb99 | ||
|
a2ff64d3e1 | ||
|
86b329840a | ||
|
9b671fa476 | ||
|
38bd61a394 |
@ -1,44 +1,46 @@
|
|||||||
/*General*/
|
/*
|
||||||
|
Crée par PALAFFRE Raphael
|
||||||
body {
|
Fonction: Lister les avis laisses
|
||||||
color:black;
|
Page CSS : avis_laisses.css
|
||||||
background-color:white;
|
*/
|
||||||
background-image:url("../ressources/image/background.jpg");
|
|
||||||
background-repeat:no-repeat;
|
body {
|
||||||
background-size:100%;
|
color:black;
|
||||||
margin: 0;
|
background-color:white;
|
||||||
font-family: Ubuntu,Helvetica,sans-serif;
|
background-attachment: fixed;
|
||||||
}
|
background-image:url("../ressources/image/background.jpg");
|
||||||
|
background-size:cover;
|
||||||
#container{
|
margin: 0;
|
||||||
margin : 5% 5% 5% 5%;
|
font-family: Ubuntu,Helvetica,sans-serif;
|
||||||
background-color : white;
|
}
|
||||||
border : 2px solid black;
|
|
||||||
}
|
#container{
|
||||||
|
margin : 5% 5% 5% 5%;
|
||||||
h1{
|
background-color : white;
|
||||||
text-align : center;
|
border : 2px solid black;
|
||||||
font-size : 250%;
|
}
|
||||||
font-weight: bold;
|
|
||||||
}
|
h1{
|
||||||
|
text-align : center;
|
||||||
h2{
|
font-size : 250%;
|
||||||
text-align : center;
|
font-weight: bold;
|
||||||
font-size : 150%;
|
}
|
||||||
font-weight: bold;
|
|
||||||
}
|
h2{
|
||||||
|
text-align : center;
|
||||||
/*Affichage avis*/
|
font-size : 150%;
|
||||||
|
font-weight: bold;
|
||||||
#bouton_retour{
|
}
|
||||||
transform : rotate(45deg);
|
|
||||||
}
|
#bouton_retour{
|
||||||
|
transform : rotate(45deg);
|
||||||
.etoile{
|
}
|
||||||
height:50px;
|
|
||||||
}
|
.etoile{
|
||||||
|
height:50px;
|
||||||
.avis_tab{
|
}
|
||||||
width:85%;
|
|
||||||
padding-left:15%;
|
.avis_tab{
|
||||||
}
|
width:85%;
|
||||||
|
padding-left:15%;
|
||||||
|
}
|
||||||
|
@ -1,81 +1,76 @@
|
|||||||
<?php
|
<?php
|
||||||
//Importation des fichiers necessaires au fonctionnement
|
session_start();
|
||||||
session_start();
|
require_once ("../connexionBD.php");
|
||||||
require_once ("../connexionBD.php");
|
require_once ("../ressources/user.php");
|
||||||
require_once ("../ressources/user.php");
|
|
||||||
|
//Si on est pas connecté redirection vers la page de connexion
|
||||||
//Si on est pas connecté redirection vers la page de connexion
|
if (!isset($_SESSION['mail'])) {
|
||||||
if (!isset($_SESSION['mail'])) {
|
header('Location: ../index.php');
|
||||||
header('Location: ../index.php');
|
exit();
|
||||||
exit();
|
}
|
||||||
}
|
$mail = $_SESSION['mail'];
|
||||||
|
|
||||||
//Recuperation de la variables de session
|
$login = getLogin($db,$mail);
|
||||||
$mail = $_SESSION['mail'];
|
|
||||||
|
$requete = "SELECT DISTINCT Avis.codetrajet, Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.codetrajet = Trajet.codetrajet AND Avis.mailemetteur = $1 AND Trajet.mailproposition = Utilisateur.mail;";
|
||||||
$login = getLogin($db,$mail);
|
$result = pg_query_params($db, $requete, array($mail));
|
||||||
|
|
||||||
|
?>
|
||||||
//Création et envoie de la requete SQL
|
|
||||||
$requete = "SELECT DISTINCT Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.mailemetteur = $1 AND Avis.mailemetteur = Utilisateur.mail;";
|
<!DOCTYPE html>
|
||||||
$result = pg_query_params($db, $requete, array($mail));
|
<html lang = "fr">
|
||||||
|
|
||||||
?>
|
<head>
|
||||||
|
<meta charset = "UTF-8">
|
||||||
<!DOCTYPE html>
|
<link rel = "stylesheet" href = "avis_laisses.css">
|
||||||
<html lang = "fr">
|
<link rel="icon" href="../ressources/favicon.ico" />
|
||||||
|
<link rel="stylesheet" href="../ressources/navbarhtml.css" />
|
||||||
<head>
|
<title>Avis Laissés</title>
|
||||||
<meta charset = "UTF-8">
|
</head>
|
||||||
<link rel = "stylesheet" href = "avis_laisses.css">
|
|
||||||
<link rel="icon" href="../ressources/favicon.ico" />
|
<body>
|
||||||
<link rel="stylesheet" href="../ressources/navbarhtml.css" />
|
|
||||||
<title>Avis Laissés</title>
|
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
||||||
</head>
|
|
||||||
|
<div id = "container">
|
||||||
<body>
|
|
||||||
|
<div id ="entete">
|
||||||
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
<a href = "../tableauBord/tableauBord.php"><img id = "bouton_retour" src = "../ressources/image/return.png" alt = "Bouton retour"></a>
|
||||||
|
<h1 id = "titre">Avis Laissés</h1>
|
||||||
<div id = "container">
|
<br>
|
||||||
|
</div>
|
||||||
<div id ="entete"> <-- Entete de la page -->
|
|
||||||
<a href = "../tableauBord/tableauBord.php"><img id = "bouton_retour" src = "../ressources/image/return.png" alt = "Bouton retour"></a>
|
<div id = "avis">
|
||||||
<h1 id = "titre">Avis Laissés</h1>
|
<table>
|
||||||
<br>
|
<?php
|
||||||
</div>
|
while ($row = pg_fetch_array($result)) {
|
||||||
|
$nom = $row['login'];
|
||||||
<div id = "avis">
|
$date = $row['dateavis'];
|
||||||
<table>
|
$commentaire = $row['commentaire'];
|
||||||
<?php
|
$note = $row['note'];
|
||||||
while ($row = pg_fetch_array($result)) { //Stockage des resultats des requete SQL
|
echo "<tr>";
|
||||||
$nom = $row['login'];
|
echo "<td class='avis_tab'>";
|
||||||
$date = $row['dateavis'];
|
echo "<h3 id='nom'>$nom</h3>";
|
||||||
$commentaire = $row['commentaire'];
|
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
|
||||||
$note = $row['note'];
|
echo "<h5 id='avis'>$commentaire</h5>";
|
||||||
echo "<tr>";
|
echo "</td>";
|
||||||
echo "<td class='avis_tab'>"; //Affichage sous forme de tableau pour la mise en page
|
echo "<td id='note_tab'>";
|
||||||
echo "<h3 id='nom'>$nom</h3>";
|
$i=0;
|
||||||
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
|
while ($i<intval($note)){
|
||||||
echo "<h5 id='avis'>$commentaire</h5>";
|
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
|
||||||
echo "</td>";
|
$i++;
|
||||||
echo "<td id='note_tab'>";
|
}
|
||||||
$i=0;
|
$i = $note;
|
||||||
while ($i<intval($note)){ //Affichage de la note laisses
|
while ($i<3){
|
||||||
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
|
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$i = $note;
|
echo "</td>";
|
||||||
while ($i<3){
|
}
|
||||||
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
|
?>
|
||||||
$i++;
|
</tr>
|
||||||
}
|
</table>
|
||||||
echo "</td>";
|
</div>
|
||||||
}
|
</div>
|
||||||
?>
|
</body>
|
||||||
</tr>
|
</html>
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
@ -1,44 +1,46 @@
|
|||||||
/*General*/
|
/*
|
||||||
|
Crée par PALAFFRE Raphael
|
||||||
body {
|
Fonction: Lister les avis recus
|
||||||
color:black;
|
Page CSS : avis_recu.css
|
||||||
background-color:white;
|
*/
|
||||||
background-image:url("../ressources/image/background.jpg");
|
|
||||||
background-repeat:no-repeat;
|
body {
|
||||||
background-size:104%;
|
color:black;
|
||||||
margin: 0;
|
background-color:white;
|
||||||
font-family: Ubuntu,Helvetica,sans-serif;
|
background-image:url("../ressources/image/background.jpg");
|
||||||
}
|
background-attachment: fixed;
|
||||||
|
background-size:cover;
|
||||||
#container{
|
margin: 0;
|
||||||
margin : 5% 5% 5% 5%;
|
font-family: Ubuntu,Helvetica,sans-serif;
|
||||||
background-color : white;
|
}
|
||||||
border : 2px solid black;
|
|
||||||
}
|
#container{
|
||||||
|
margin : 5% 5% 5% 5%;
|
||||||
h1{
|
background-color : white;
|
||||||
text-align : center;
|
border : 2px solid black;
|
||||||
font-size : 250%;
|
}
|
||||||
font-weight: bold;
|
|
||||||
}
|
h1{
|
||||||
|
text-align : center;
|
||||||
h2{
|
font-size : 250%;
|
||||||
text-align : center;
|
font-weight: bold;
|
||||||
font-size : 150%;
|
}
|
||||||
font-weight: bold;
|
|
||||||
}
|
h2{
|
||||||
|
text-align : center;
|
||||||
/*Affichage avis*/
|
font-size : 150%;
|
||||||
|
font-weight: bold;
|
||||||
#bouton_retour{
|
}
|
||||||
transform : rotate(45deg);
|
|
||||||
}
|
#bouton_retour{
|
||||||
|
transform : rotate(45deg);
|
||||||
.etoile{
|
}
|
||||||
height:50px;
|
|
||||||
}
|
.etoile{
|
||||||
|
height:50px;
|
||||||
.avis_tab{
|
}
|
||||||
width:85%;
|
|
||||||
padding-left:15%;
|
.avis_tab{
|
||||||
}
|
width:85%;
|
||||||
|
padding-left:15%;
|
||||||
|
}
|
||||||
|
@ -1,76 +1,70 @@
|
|||||||
<?php
|
<?php
|
||||||
//Importation des fichiers
|
session_start();
|
||||||
session_start();
|
require_once("../connexionBD.php");
|
||||||
require_once("../connexionBD.php");
|
require_once("../ressources/user.php");
|
||||||
require_once("../ressources/user.php");
|
|
||||||
|
//Si on est pas connecté redirection vers la page de connexion
|
||||||
//Si on est pas connecté redirection vers la page de connexion
|
if (!isset($_SESSION['mail'])) {
|
||||||
if (!isset($_SESSION['mail'])) {
|
header('Location: ../index.php');
|
||||||
header('Location: ../index.php');
|
exit();
|
||||||
exit();
|
}
|
||||||
}
|
$mail = $_SESSION['mail'];
|
||||||
|
|
||||||
//Recuperation variable session
|
$login = getLogin($db, $mail);
|
||||||
$mail = $_SESSION['mail'];
|
|
||||||
|
$requete = "SELECT DISTINCT Avis.mailemetteur, Avis.codetrajet, Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.codetrajet = Trajet.codetrajet AND Trajet.mailproposition = $1 AND Avis.mailemetteur = Utilisateur.mail;";
|
||||||
$login = getLogin($db, $mail);
|
$result = pg_query_params($db, $requete, array($mail));
|
||||||
|
?>
|
||||||
//Creation et envoie de la requete SQL
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
$requete = "SELECT DISTINCT Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.codetrajet = Trajet.codetrajet AND Trajet.mailproposition = $1 AND Trajet.mailproposition = Utilisateur.mail;";
|
<head>
|
||||||
$result = pg_query_params($db, $requete, array($mail));
|
<meta charset="UTF-8">
|
||||||
?>
|
<link rel="stylesheet" href="avis_recus.css">
|
||||||
|
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||||
<!DOCTYPE html>
|
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||||
<html>
|
<title>Avis Recus</title>
|
||||||
<head>
|
</head>
|
||||||
<meta charset="UTF-8">
|
<body>
|
||||||
<link rel="stylesheet" href="avis_recus.css">
|
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
||||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
<div id="container">
|
||||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
<div id="entete">
|
||||||
<title>Avis Recus</title>
|
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour"
|
||||||
</head>
|
src="../ressources/image/return.png"
|
||||||
<body>
|
alt="Bouton retour"></a>
|
||||||
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
<h1 id="titre">Avis Recus</h1>
|
||||||
|
<br>
|
||||||
<div id="container">
|
</div>
|
||||||
<div id="entete"> <-- Entete -->
|
<div id="avis">
|
||||||
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour"
|
<table>
|
||||||
src="../ressources/image/return.png"
|
<?php while ($row = pg_fetch_array($result)) {
|
||||||
alt="Bouton retour"></a>
|
pg_query_params($db, "UPDATE Avis SET estlu = true WHERE mailemetteur = $1 AND codetrajet = $2;", array($row['mailemetteur'], $row['codetrajet']));
|
||||||
<h1 id="titre">Avis Recus</h1>
|
$nom = $row['login'];
|
||||||
<br>
|
$date = $row['dateavis'];
|
||||||
</div>
|
$commentaire = $row['commentaire'];
|
||||||
<div id="avis"> <-- Avis recus -->
|
$note = $row['note'];
|
||||||
<table>
|
echo "<tr>";
|
||||||
<?php while ($row = pg_fetch_array($result)) { //Stockage des valeurs de retour de la requete SQL
|
echo "<td class='avis_tab'>";
|
||||||
$nom = $row['login'];
|
echo "<h3 id='nom'>$nom</h3>";
|
||||||
$date = $row['dateavis'];
|
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
|
||||||
$commentaire = $row['commentaire'];
|
echo "<h5 id='avis'>$commentaire</h5>";
|
||||||
$note = $row['note'];
|
echo "</td>";
|
||||||
echo "<tr>"; //Affichage des resultat sour forme de tableau
|
echo "<td id='note_tab'>";
|
||||||
echo "<td class='avis_tab'>";
|
$i=0;
|
||||||
echo "<h3 id='nom'>$nom</h3>";
|
while ($i<intval($note)){
|
||||||
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
|
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
|
||||||
echo "<h5 id='avis'>$commentaire</h5>";
|
$i++;
|
||||||
echo "</td>";
|
}
|
||||||
echo "<td id='note_tab'>";
|
$i = $note;
|
||||||
$i=0;
|
while ($i<3){
|
||||||
while ($i<intval($note)){ //Affichage des notes recus
|
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
|
||||||
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
|
$i++;
|
||||||
$i++;
|
}
|
||||||
}
|
echo "</td>";
|
||||||
$i = $note;
|
}
|
||||||
while ($i<3){
|
?>
|
||||||
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
|
</tr>
|
||||||
$i++;
|
</table>
|
||||||
}
|
</div>
|
||||||
echo "</td>";
|
</div>
|
||||||
}
|
</body>
|
||||||
?>
|
</html>
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
body{
|
body{
|
||||||
background-image:url("../ressources/image/background.jpg");
|
background-image:url("../ressources/image/background.jpg");
|
||||||
|
background-attachment: fixed;
|
||||||
|
background-size: cover;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
@ -52,10 +54,12 @@ h1{
|
|||||||
}
|
}
|
||||||
|
|
||||||
#formulaire{
|
#formulaire{
|
||||||
|
margin-top: 3em;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
padding: 4em;
|
padding: 4em;
|
||||||
width: 40%;
|
width: 40%;
|
||||||
|
margin-bottom: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form{
|
.form{
|
||||||
|
@ -62,7 +62,6 @@ if (isset($_POST['dateDepart']) && isset($_POST['dateArrivee']) && isset($_POST[
|
|||||||
<body>
|
<body>
|
||||||
<script type="application/javascript" src="../ressources/libs/jquery-3.4.1.js"></script>
|
<script type="application/javascript" src="../ressources/libs/jquery-3.4.1.js"></script>
|
||||||
<script type="application/javascript" src="../ressources/libs/jquery-ui.min.js"></script>
|
<script type="application/javascript" src="../ressources/libs/jquery-ui.min.js"></script>
|
||||||
<script type="application/javascript" src="../ressources/libs/chosen.jquery.min.js"></script>
|
|
||||||
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
||||||
<div id="formulaire">
|
<div id="formulaire">
|
||||||
<h1>Déposer un trajet</h1>
|
<h1>Déposer un trajet</h1>
|
||||||
|
@ -1,61 +1,55 @@
|
|||||||
/*General*/
|
body {
|
||||||
|
color:black;
|
||||||
body {
|
background-color:white;
|
||||||
color:black;
|
background-image:url("../ressources/image/background.jpg");
|
||||||
background-color:white;
|
background-attachment: fixed;
|
||||||
background-image:url("../ressources/image/background.jpg");
|
background-size:cover;
|
||||||
background-repeat:no-repeat;
|
margin: 0;
|
||||||
background-size:104%;
|
font-family: Ubuntu,Helvetica,sans-serif;
|
||||||
margin: 0;
|
}
|
||||||
font-family: Ubuntu,Helvetica,sans-serif;
|
|
||||||
}
|
#container{
|
||||||
|
margin : 5% 15% 5% 15%;
|
||||||
#container{
|
background-color : white;
|
||||||
margin : 5% 15% 5% 15%;
|
border : 2px solid black;
|
||||||
background-color : white;
|
}
|
||||||
border : 2px solid black;
|
|
||||||
}
|
h1{
|
||||||
|
text-align : center;
|
||||||
h1{
|
font-size : 250%;
|
||||||
text-align : center;
|
font-weight: bold;
|
||||||
font-size : 250%;
|
}
|
||||||
font-weight: bold;
|
|
||||||
}
|
#form{
|
||||||
|
text-align:center;
|
||||||
/*Formulaire*/
|
}
|
||||||
|
|
||||||
#form{
|
#avis_laisse{
|
||||||
text-align:center;
|
box-sizing: border-box;
|
||||||
}
|
resize: none;
|
||||||
|
width: 70%;
|
||||||
#avis_laisse{
|
height: 16em;
|
||||||
box-sizing: border-box;
|
}
|
||||||
resize: none;
|
|
||||||
width: 70%;
|
#submit{
|
||||||
height: 16em;
|
margin-bottom: 1%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#submit{
|
.rating {
|
||||||
margin-bottom: 1%;
|
direction: rtl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Etoile de notation*/
|
.rating a {
|
||||||
|
color: #aaa;
|
||||||
.rating {
|
text-decoration: none;
|
||||||
direction: rtl;
|
font-size: 3em;
|
||||||
}
|
transition: color .4s;
|
||||||
|
}
|
||||||
.rating a {
|
|
||||||
color: #aaa;
|
.rating a:hover,
|
||||||
text-decoration: none;
|
.rating a:focus,
|
||||||
font-size: 3em;
|
.rating a:hover ~ a,
|
||||||
transition: color .4s;
|
.rating a:focus ~ a {
|
||||||
}
|
color: orange;
|
||||||
|
cursor: pointer;
|
||||||
.rating a:hover,
|
|
||||||
.rating a:focus,
|
|
||||||
.rating a:hover ~ a,
|
|
||||||
.rating a:focus ~ a {
|
|
||||||
color: orange;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
@ -1,92 +1,89 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
//Declaration des fonctions
|
//Verifier qu'un avis n'a pas déja été envoyer avec le compte $mail pour le trajet $codetrajet
|
||||||
|
function checkAvis($db, $mail, $codetrajet)
|
||||||
function checkAvis($db, $mail, $codetrajet)
|
{
|
||||||
{
|
$result = pg_query_params($db, "SELECT COUNT(*) FROM avis WHERE mailEmetteur = $1 AND codetrajet = $2;", array($mail, $codetrajet));
|
||||||
$result = pg_query_params($db, "SELECT COUNT(*) FROM avis WHERE mailEmetteur = $1 AND codetrajet = $2;", array($mail, $codetrajet));
|
$row = pg_fetch_array($result);
|
||||||
$row = pg_fetch_array($result);
|
return $row[0] == 0;
|
||||||
return $row[0] == 0;
|
}
|
||||||
}
|
|
||||||
|
//Verifier que le trajet à bien été fait par l'utilisateur $mail
|
||||||
function checkCodeTrajetAvis($db, $mail, $codetrajet)
|
function checkCodeTrajetAvis($db, $mail, $codetrajet)
|
||||||
{
|
{
|
||||||
$result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver re WHERE tr.codetrajet = $1 AND tr.codetrajet = re.codetrajet AND re.mailutilisateur = $2;", array($codetrajet, $mail));
|
$result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver re WHERE tr.codetrajet = $1 AND tr.codetrajet = re.codetrajet AND re.mailutilisateur = $2;", array($codetrajet, $mail));
|
||||||
$row = pg_fetch_array($result);
|
$row = pg_fetch_array($result);
|
||||||
return $row[0] >= 1;
|
return $row[0] >= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Importation des fichiers necessaires
|
session_start();
|
||||||
|
require_once("../connexionBD.php");
|
||||||
session_start();
|
require_once("../ressources/user.php");
|
||||||
require_once("../connexionBD.php");
|
|
||||||
require_once("../ressources/user.php");
|
//Si on est pas connecté redirection vers la page de connexion
|
||||||
|
if (!isset($_SESSION['mail'])) {
|
||||||
//Si on est pas connecté redirection vers la page de connexion
|
header('Location: ../index.php');
|
||||||
|
exit();
|
||||||
if (!isset($_SESSION['mail'])) {
|
}
|
||||||
header('Location: ../index.php');
|
|
||||||
exit();
|
$mail = $_SESSION['mail'];
|
||||||
}
|
if (isset($_POST['codetrajet']) && isset($_POST['avislaisse']) && isset($_POST['note'])) {
|
||||||
|
$avis = $_POST['avislaisse'];
|
||||||
$mail = $_SESSION['mail'];
|
$note = $_POST['note'];
|
||||||
if (isset($_POST['codetrajet']) && isset($_POST['avislaisse']) && isset($_POST['note'])) {
|
$codetrajet = intval($_POST['codetrajet']);
|
||||||
//Recuperation des variables passer par le formulaire
|
$date = date('Y-m-d H:i:s');
|
||||||
$avis = $_POST['avislaisse'];
|
//Verifier que l'utilisateur a bien participé au trajet et qu'il n'en a pas déjà poster un
|
||||||
$note = $_POST['note'];
|
if (checkAvis($db, $mail, $codetrajet) && checkCodeTrajetAvis($db, $mail, $codetrajet)) {
|
||||||
$codetrajet = intval($_POST['codetrajet']);
|
$requete = "INSERT INTO avis (mailemetteur, codetrajet, commentaire, dateavis, note, estlu) VALUES ($1,$2,$3,$4,$5, false);";
|
||||||
$date = date('Y-m-d H:i:s');
|
$envoi = pg_query_params($db, $requete, array($mail, $codetrajet, $avis, $date, $note));
|
||||||
if (checkAvis($db, $mail, $codetrajet) && checkCodeTrajetAvis($db, $mail, $codetrajet)) {
|
if (!$envoi) {
|
||||||
$requete = "INSERT INTO avis (mailemetteur, codetrajet, commentaire, dateavis, note, estlu) VALUES ($1,$2,$3,$4,$5, false);"; //Requete d'insertion
|
echo "Erreur d'ecriture dans la BD";
|
||||||
$envoi = pg_query_params($db, $requete, array($mail, $codetrajet, $avis, $date, $note)); // Envoie de la requete
|
echo "<br><a href='../tableauBord/tableauBord.php'>Retour vers le tableau de bord</a>";
|
||||||
if (!$envoi) { //Erreur
|
exit();
|
||||||
echo "Erreur d'ecriture dans la BD";
|
} else {
|
||||||
echo "<br><a href='../tableauBord/tableauBord.php'>Retour vers le tableau de bord</a>";
|
header('Location: ../tableauBord/tableauBord.php');
|
||||||
exit();
|
exit();
|
||||||
} else { //Redirection en cas de reussite
|
}
|
||||||
header('Location: ../tableauBord/tableauBord.php');
|
}
|
||||||
exit();
|
}
|
||||||
}
|
?>
|
||||||
}
|
<!DOCTYPE html>
|
||||||
}
|
<html lang="fr">
|
||||||
?>
|
<head>
|
||||||
<!DOCTYPE html>
|
<meta charset="UTF-8">
|
||||||
<html lang="fr">
|
<link rel="stylesheet" href="deposer_avis.css">
|
||||||
<head>
|
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||||
<meta charset="UTF-8">
|
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||||
<link rel="stylesheet" href="deposer_avis.css">
|
<title>Deposer un avis</title>
|
||||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
</head>
|
||||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
<body>
|
||||||
<title>Deposer un avis</title>
|
<?php require_once("../ressources/navbarhtml.php"); ?>
|
||||||
</head>
|
<div id="container">
|
||||||
<body>
|
<div id="entete">
|
||||||
<?php require_once("../ressources/navbarhtml.php"); ?>
|
<h1 id="titre">Deposer un avis</h1>
|
||||||
<div id="container">
|
</div>
|
||||||
<div id="entete"> <--Entete-->
|
<div id="form">
|
||||||
<h1 id="titre">Deposer un avis</h1>
|
<form id="formulaire_avis" enctype="multipart/form-data" action="deposer_avis.php" method="post">
|
||||||
</div>
|
<textarea id="avis_laisse" name="avislaisse" form="formulaire_avis" placeholder="Avis"></textarea>
|
||||||
<div id="form"><--Formulaire-->
|
<h2>NOTE</h2>
|
||||||
<form id="formulaire_avis" enctype="multipart/form-data" action="deposer_avis.php" method="post">
|
<div class="rating">
|
||||||
<textarea id="avis_laisse" name="avislaisse" form="formulaire_avis" placeholder="Avis"></textarea> <--Champ_de_saisie_d_avis-->
|
<input type="radio" name="note" id="note3" value="3">
|
||||||
<h2>NOTE</h2>
|
<a href="#3" label for="note3" title="Donner 3 étoiles">☆</a>
|
||||||
<div class="rating"><--Bouton_note-->
|
<input type="radio" name="note" id="note2" value="2">
|
||||||
<input type="radio" name="note" id="note3" value="3">
|
<a href="#2" label for="note2" title="Donner 2 étoiles">☆</a>
|
||||||
<a href="#3" label for="note3" title="Donner 3 étoiles">☆</a>
|
<input type="radio" name="note" id="note1" value="1">
|
||||||
<input type="radio" name="note" id="note2" value="2">
|
<a href="#1" label for="note1" title="Donner 1 étoiles">☆</a>
|
||||||
<a href="#2" label for="note2" title="Donner 2 étoiles">☆</a>
|
<?php
|
||||||
<input type="radio" name="note" id="note1" value="1">
|
if (isset($_GET['codetrajet'])) {
|
||||||
<a href="#1" label for="note1" title="Donner 1 étoiles">☆</a>
|
$codeTrajet = $_GET['codetrajet'];
|
||||||
<?php
|
echo "<input type='hidden' name='codetrajet' value='$codeTrajet'>";
|
||||||
if (isset($_GET['codetrajet'])) {
|
}
|
||||||
$codeTrajet = $_GET['codetrajet'];
|
?>
|
||||||
echo "<input type='hidden' name='codetrajet' value='$codeTrajet'>";
|
</div>
|
||||||
}
|
<br>
|
||||||
?>
|
<input type="submit" value="Valider" id="submit">
|
||||||
</div>
|
</form>
|
||||||
<br>
|
</div>
|
||||||
<input type="submit" value="Valider" id="submit"><--Envoie-->
|
</div>
|
||||||
</form>
|
</body>
|
||||||
</div>
|
</html>
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
@ -10,6 +10,9 @@ html, body{
|
|||||||
}
|
}
|
||||||
|
|
||||||
body{
|
body{
|
||||||
|
background-image: url("ressources/image/background.jpg");
|
||||||
|
background-size: cover;
|
||||||
|
background-attachment: fixed;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -8,6 +8,7 @@ if(!isset($_SESSION['mail'])){
|
|||||||
|
|
||||||
$mail = strtolower(htmlentities(pg_escape_string ($_POST['mail_field'])));
|
$mail = strtolower(htmlentities(pg_escape_string ($_POST['mail_field'])));
|
||||||
$password = htmlentities(pg_escape_string($_POST['password']));
|
$password = htmlentities(pg_escape_string($_POST['password']));
|
||||||
|
//Vérification des information d'authentification
|
||||||
$result = authentification($db, $mail, $password);
|
$result = authentification($db, $mail, $password);
|
||||||
if($result) {
|
if($result) {
|
||||||
$_SESSION['mail'] = $mail;
|
$_SESSION['mail'] = $mail;
|
||||||
|
@ -10,14 +10,17 @@ html, body{
|
|||||||
}
|
}
|
||||||
|
|
||||||
body{
|
body{
|
||||||
|
background-image:url("../ressources/image/background.jpg");
|
||||||
|
background-attachment: fixed;
|
||||||
|
background-size: cover;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#formulaire{
|
#formulaire{
|
||||||
|
margin-top: 3em;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
padding: 4em;
|
padding: 4em;
|
||||||
|
@ -3,61 +3,60 @@ session_start();
|
|||||||
require_once('../connexionBD.php');
|
require_once('../connexionBD.php');
|
||||||
require_once('../ressources/user.php');
|
require_once('../ressources/user.php');
|
||||||
|
|
||||||
if (!isset($_SESSION['mail'])){
|
if (!isset($_SESSION['mail'])) {
|
||||||
if (isset($_POST['login']) || isset($_FILES['avatar'])){
|
if (isset($_POST['login']) || isset($_FILES['avatar'])) {
|
||||||
if (isset($_POST['login']) && isset($_POST['password']) && isset($_POST['confirmation']) && isset($_POST['prenom']) && isset($_POST['nom']) && isset($_POST['phone'])){
|
if (isset($_POST['login']) && isset($_POST['password']) && isset($_POST['confirmation']) && isset($_POST['prenom']) && isset($_POST['nom']) && isset($_POST['phone'])) {
|
||||||
$login = htmlentities(pg_escape_string($_POST['login']));
|
$login = htmlentities(pg_escape_string($_POST['login']));
|
||||||
$password = htmlentities(pg_escape_string($_POST['password']));
|
$password = htmlentities(pg_escape_string($_POST['password']));
|
||||||
$prenom = htmlentities(pg_escape_string($_POST['prenom']));
|
$prenom = htmlentities(pg_escape_string($_POST['prenom']));
|
||||||
$nom = htmlentities(pg_escape_string($_POST['nom']));
|
$nom = htmlentities(pg_escape_string($_POST['nom']));
|
||||||
$dateN = htmlentities(pg_escape_string($_POST['dateN']));
|
$dateN = htmlentities(pg_escape_string($_POST['dateN']));
|
||||||
$mail = strtolower(htmlentities(pg_escape_string($_POST['mail'])));
|
$mail = strtolower(htmlentities(pg_escape_string($_POST['mail'])));
|
||||||
$phone = htmlentities(pg_escape_string($_POST['phone']));
|
$phone = htmlentities(pg_escape_string($_POST['phone']));
|
||||||
|
//Verifier que le format du mail est correct
|
||||||
|
if (!filter_var($mail, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
header('Location: inscription.php?error=1');
|
||||||
|
exit();
|
||||||
|
} //Verifie qu'un compte n'a pas déjà été créé avec ce mail
|
||||||
|
elseif (!isMailUnique($db, $mail)) {
|
||||||
|
header('Location: inscription.php?error=2');
|
||||||
|
exit();
|
||||||
|
} //Verifie que le login entré est unique
|
||||||
|
elseif (!isLoginUnique($db, $login)) {
|
||||||
|
header('Location: inscription.php?error=3');
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
|
||||||
if (!filter_var($mail, FILTER_VALIDATE_EMAIL)){
|
if (isset($_FILES['avatar']) and !empty($_FILES['avatar']['name'])) {
|
||||||
header('Location: inscription.php?error=1');
|
$fic = $_FILES['avatar'];
|
||||||
exit();
|
//Charger l'avatar sur le serveur
|
||||||
}
|
$res = uploadAvatar($mail, $fic);
|
||||||
elseif (!isMailUnique($db, $mail)){
|
switch ($res) {
|
||||||
header('Location: inscription.php?error=2');
|
case -1:
|
||||||
exit();
|
header('Location: inscription.php?error=4');
|
||||||
}
|
exit();
|
||||||
elseif (!isLoginUnique($db, $login)){
|
case -2:
|
||||||
header('Location: inscription.php?error=3');
|
header('Location: inscription.php?error=5');
|
||||||
exit();
|
exit();
|
||||||
}
|
case -3:
|
||||||
else {
|
header('Location: inscription.php?error=6');
|
||||||
if (isset($_FILES['avatar']) and !empty($_FILES['avatar']['name'])) {
|
exit();
|
||||||
$fic = $_FILES['avatar'];
|
}
|
||||||
$res = uploadAvatar($mail, $fic);
|
}
|
||||||
switch ($res){
|
$result = creerUtilisateur($db, $mail, $password, $prenom, $nom, $login, $phone, $dateN);
|
||||||
case -1:
|
if ($result) {
|
||||||
header('Location: inscription.php?error=4');
|
header('Location: ../index.php');
|
||||||
exit();
|
exit();
|
||||||
case -2:
|
} else {
|
||||||
header('Location: inscription.php?error=5');
|
header('Location: inscription.php?error=6');
|
||||||
exit();
|
exit();
|
||||||
case -3:
|
}
|
||||||
header('Location: inscription.php?error=6');
|
}
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$result = creerUtilisateur($db, $mail, $password, $prenom, $nom, $login, $phone, $dateN);
|
|
||||||
if ($result) {
|
|
||||||
header('Location: ../index.php');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
header('Location: inscription.php?error=6');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
}
|
header('Location: ../tableauBord/tableauBord.php');
|
||||||
}
|
exit();
|
||||||
else {
|
|
||||||
header('Location: ../tableauBord/tableauBord.php');
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -2,8 +2,8 @@ body {
|
|||||||
color:black;
|
color:black;
|
||||||
background-color:white;
|
background-color:white;
|
||||||
background-image:url("../ressources/image/background.jpg");
|
background-image:url("../ressources/image/background.jpg");
|
||||||
background-repeat:no-repeat;
|
background-attachment: fixed;
|
||||||
background-size:104%;
|
background-size:cover;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: Ubuntu,Helvetica,sans-serif;
|
font-family: Ubuntu,Helvetica,sans-serif;
|
||||||
}
|
}
|
||||||
|
@ -36,16 +36,22 @@ require_once("../ressources/navbarhtml.php");
|
|||||||
<div id="liste">
|
<div id="liste">
|
||||||
<table>
|
<table>
|
||||||
<?php
|
<?php
|
||||||
$result = pg_query_params($db, "SELECT * FROM Trajet Where mailproposition = $1 AND estannule = false;", array($mail));
|
$result = pg_query_params($db, "SELECT * FROM Trajet Where mailproposition = $1 AND estannule = false ORDER BY datedepart DESC;", array($mail));
|
||||||
while ($row = pg_fetch_array($result)) {
|
while ($row = pg_fetch_array($result)) {
|
||||||
$login = getLogin($db, $mail);
|
$login = getLogin($db, $mail);
|
||||||
$date_depart = $row['datedepart'];
|
$date_depart = $row['datedepart'];
|
||||||
$codetrajet = $row['codetrajet'];
|
$codetrajet = $row['codetrajet'];
|
||||||
$source = getDepart($db, $codetrajet);
|
$source = getDepart($db, $codetrajet);
|
||||||
$dest = getFin($db, $codetrajet);
|
$dest = getFin($db, $codetrajet);
|
||||||
|
$date = date('Y-m-d H:i:s');
|
||||||
echo "<tr><td class='ligne'><hr class='separation'/></td><td class='info'>";
|
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 "<p>$date_depart - ".$source['nomville']." (".$source['codepostal'].") vers ".$dest['nomville']." (".$dest['codepostal'].") proposé par : $login</p></td>";
|
||||||
echo "<td><a href='annulerTrajet.php?codetrajet=$codetrajet'>Annuler le trajet</a></td>";
|
if ($date <= $row['datearrivee']){
|
||||||
|
echo "<td><a href='annulerTrajet.php?codetrajet=$codetrajet'>Annuler le trajet</a></td>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<td class='info'><p>Trajet effectué</p></td>";
|
||||||
|
}
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -2,8 +2,8 @@ body {
|
|||||||
color:black;
|
color:black;
|
||||||
background-color:white;
|
background-color:white;
|
||||||
background-image:url("../ressources/image/background.jpg");
|
background-image:url("../ressources/image/background.jpg");
|
||||||
background-repeat:no-repeat;
|
background-attachment: fixed;
|
||||||
background-size:104%;
|
background-size:cover;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: Ubuntu,Helvetica,sans-serif;
|
font-family: Ubuntu,Helvetica,sans-serif;
|
||||||
}
|
}
|
||||||
|
@ -34,17 +34,26 @@ require_once("../ressources/navbarhtml.php");
|
|||||||
<div id="liste">
|
<div id="liste">
|
||||||
<table>
|
<table>
|
||||||
<?php
|
<?php
|
||||||
$result = pg_query_params($db, "SELECT DISTINCT ut.login as login, tr.* FROM utilisateur ut, trajet tr, reserver re WHERE ut.mail = re.mailutilisateur AND re.codetrajet = tr.codetrajet AND re.mailutilisateur = $1 AND tr.estannule = false;", array($mail));
|
$result = pg_query_params($db, "SELECT DISTINCT ut.login as login, tr.* FROM utilisateur ut, trajet tr, reserver re WHERE ut.mail = re.mailutilisateur AND re.codetrajet = tr.codetrajet AND re.mailutilisateur = $1 AND tr.estannule = false ORDER BY datedepart DESC;", array($mail));
|
||||||
while ($row = pg_fetch_array($result)) {
|
while ($row = pg_fetch_array($result)) {
|
||||||
$login = $row['login'];
|
$login = $row['login'];
|
||||||
$date_depart = $row['datedepart'];
|
$date_depart = $row['datedepart'];
|
||||||
$codetrajet = $row['codetrajet'];
|
$codetrajet = $row['codetrajet'];
|
||||||
$source = getDepart($db, $codetrajet);
|
$source = getDepart($db, $codetrajet);
|
||||||
|
$date = date('Y-m-d H:i:s');
|
||||||
$dest = getFin($db, $codetrajet);
|
$dest = getFin($db, $codetrajet);
|
||||||
echo "<tr><td class='ligne'><hr class='separation'/></td>";
|
echo "<tr><td class='ligne'><hr class='separation'/></td>";
|
||||||
echo "<td class='info'><p>$date_depart - $source vers $dest proposé par : $login</p></td>";
|
echo "<td class='info'><p>$date_depart - ".$source['nomville']." (".$source['codepostal'].") vers ".$dest['nomville']." (".$dest['codepostal'].") proposé par : $login</p></td>";
|
||||||
echo "<td><a href='annulerReservation.php?codetrajet=$codetrajet'>Annuler la reservation</a></td>";
|
|
||||||
echo "<td><a href='../deposer_avis/deposer_avis.php?codetrajet=$codetrajet'>Déposer un avis</a></td>";
|
if ($date <= $row['datearrivee']){
|
||||||
|
echo "<td><a href='annulerReservation.php?codetrajet=$codetrajet'>Annuler la reservation</a></td>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<td class='info'><p>Trajet effectué</p></td>";
|
||||||
|
}
|
||||||
|
if (!avisExiste($db, $mail, $codetrajet)){
|
||||||
|
echo "<td><a href='../deposer_avis/deposer_avis.php?codetrajet=$codetrajet'>Déposer un avis</a></td>";
|
||||||
|
}
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -1,53 +1,49 @@
|
|||||||
/*General*/
|
body {
|
||||||
|
color:black;
|
||||||
body {
|
background-color:white;
|
||||||
color:black;
|
background-image:url("../ressources/image/background.jpg");
|
||||||
background-color:white;
|
background-attachment: fixed;
|
||||||
background-image:url("../ressources/image/background.jpg");
|
background-size:cover;
|
||||||
background-repeat:no-repeat;
|
margin: 0;
|
||||||
background-size:104%;
|
font-family: Ubuntu,Helvetica,sans-serif;
|
||||||
margin: 0;
|
}
|
||||||
font-family: Ubuntu,Helvetica,sans-serif;
|
|
||||||
}
|
#container{
|
||||||
|
margin : 5% 5% 5% 5%;
|
||||||
#container{
|
background-color : white;
|
||||||
margin : 5% 5% 5% 5%;
|
border : 2px solid black;
|
||||||
background-color : white;
|
}
|
||||||
border : 2px solid black;
|
|
||||||
}
|
h1{
|
||||||
|
text-align : center;
|
||||||
h1{
|
font-size : 250%;
|
||||||
text-align : center;
|
font-weight: bold;
|
||||||
font-size : 250%;
|
}
|
||||||
font-weight: bold;
|
|
||||||
}
|
h2{
|
||||||
|
text-align : center;
|
||||||
h2{
|
font-size : 150%;
|
||||||
text-align : center;
|
font-weight: bold;
|
||||||
font-size : 150%;
|
}
|
||||||
font-weight: bold;
|
|
||||||
}
|
#bouton_retour{
|
||||||
|
transform : rotate(45deg);
|
||||||
/*Affichage liste trajets*/
|
}
|
||||||
|
|
||||||
#bouton_retour{
|
.separation{
|
||||||
transform : rotate(45deg);
|
margin-top : 5%;
|
||||||
}
|
margin-left : 20%;
|
||||||
|
min-height: 2em;
|
||||||
.separation{
|
width : 5px;
|
||||||
margin-top : 5%;
|
background: black;
|
||||||
margin-left : 20%;
|
}
|
||||||
min-height: 2em;
|
|
||||||
width : 5px;
|
td{
|
||||||
background: black;
|
padding-left: 1.5em;
|
||||||
}
|
padding-right: 1.5em;
|
||||||
|
width: 33%;
|
||||||
td{
|
}
|
||||||
padding-left: 1.5em;
|
|
||||||
padding-right: 1.5em;
|
#info{
|
||||||
width: 33%;
|
width: 60%;
|
||||||
}
|
|
||||||
|
|
||||||
#info{
|
|
||||||
width: 60%;
|
|
||||||
}
|
}
|
@ -1,81 +1,75 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
|
require_once("../connexionBD.php");
|
||||||
//Importation des fichiers necessaires
|
require_once("../ressources/trajet.php");
|
||||||
|
|
||||||
require_once("../connexionBD.php");
|
//Si on est pas connecté redirection vers la page de connexion
|
||||||
require_once("../ressources/trajet.php");
|
if (!isset($_SESSION['mail'])) {
|
||||||
|
header('Location: ../index.php');
|
||||||
//Si on est pas connecté redirection vers la page de connexion
|
exit();
|
||||||
|
}
|
||||||
if (!isset($_SESSION['mail'])) {
|
$mail = $_SESSION['mail'];
|
||||||
header('Location: ../index.php');
|
if (!(isset($_POST['villeDepart']) && isset($_POST['villeArrive']) && isset($_POST['date_heure']))) {
|
||||||
exit();
|
header('Location: ../tableauBord/tableauBord.php');
|
||||||
}
|
exit();
|
||||||
|
}
|
||||||
$mail = $_SESSION['mail'];
|
$source = explode('%%', $_POST['villeDepart']);
|
||||||
if (!(isset($_POST['lieu_depart']) && isset($_POST['lieu_arrivee']) && isset($_POST['date_heure']))){
|
$cpsource = $source[1];
|
||||||
header('Location: ../tableauBord/tableauBord.php');
|
$source = $source[0];
|
||||||
exit();
|
$dest = explode('%%', $_POST['villeArrive']);
|
||||||
}
|
$cpdest = $dest[1];
|
||||||
|
$dest = $dest[0];
|
||||||
if (isset($_POST['lieu_depart']) && isset($_POST['lieu_arrivee']) && isset($_POST['date_heure'])) {
|
$date_depart = $_POST['date_heure'];
|
||||||
$source = $_POST['lieu_depart']; //Recuperation des valeurs passé par le form
|
if ($date_depart < date('Y-m-d')) {
|
||||||
$dest = $_POST['lieu_arrivee'];
|
echo "Erreur date</br>";
|
||||||
$date_depart = $_POST['date_heure'];
|
echo "<a href='../tableauBord/tableauBord.php'>Retour vers le tableau de bord</a>";
|
||||||
if ($date_depart < date('Y-m-d')){ //Verification de date
|
exit();
|
||||||
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) AND codepostal = $4))
|
||||||
}
|
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 LOWER(v.nomville) = LOWER($2) AND v.codepostal = $5 AND tr.codepostal = v.codepostal AND tr.numeroetape != 1);", array($source, $dest, $date_depart, $cpsource, $cpdest));
|
||||||
}
|
|
||||||
|
?>
|
||||||
//Requete de selection des trajets a affiché
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
$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)))
|
<head>
|
||||||
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));
|
<meta charset="UTF-8">
|
||||||
|
<link rel="stylesheet" href="liste_trajet.css">
|
||||||
?>
|
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||||
<!DOCTYPE html>
|
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||||
<html lang="fr">
|
<title>Liste des trajets</title>
|
||||||
<head>
|
</head>
|
||||||
<meta charset="UTF-8">
|
<body>
|
||||||
<link rel="stylesheet" href="liste_trajet.css">
|
<?php
|
||||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
require_once("../ressources/navbarhtml.php");
|
||||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
?>
|
||||||
<title>Liste des trajets</title>
|
<div id="container">
|
||||||
</head>
|
<div id="entete">
|
||||||
<body>
|
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour" src="../ressources/image/return.png"
|
||||||
<?php
|
alt="Bouton retour"></a>
|
||||||
require_once("../ressources/navbarhtml.php");
|
<h1 class="float" id="titre">Liste des trajets</h1>
|
||||||
?>
|
<br>
|
||||||
<div id="container">
|
<h2>Trajets recherchés : <?php echo "$source ($cpsource) vers $dest ($cpdest)"; ?></h2>
|
||||||
<div id="entete"> <--Entete-->
|
</div>
|
||||||
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour" src="../ressources/image/return.png"
|
<div id="liste">
|
||||||
alt="Bouton retour"></a>
|
<table>
|
||||||
<h1 class="float" id="titre">Liste des trajets</h1>
|
<?php
|
||||||
<br>
|
while ($row = pg_fetch_array($result)) {
|
||||||
<h2>Trajets recherchés : <?php echo $source . " vers " . $dest; ?></h2>
|
$codetrajet = $row['codetrajet'];
|
||||||
</div>
|
$login = $row['login'];
|
||||||
<div id="liste">
|
$source = getDepart($db, $codetrajet);
|
||||||
<table>
|
$dest = getFin($db, $codetrajet);
|
||||||
<?php
|
$date_depart = $row['datedepart'];
|
||||||
while ($row = pg_fetch_array($result)) { //Recuperation des resultats de la requete
|
if (checkPlacesVoiture($db, $codetrajet) && $date_depart >= date('Y-m-d H:i:s')) {
|
||||||
$codetrajet = $row['codetrajet'];
|
echo "<tr><td class='ligne'><hr class='separation'/></td><td class='info'>";
|
||||||
$login = $row['login'];
|
echo "<p>$date_depart - ".$source['nomvile']." (".$source['codepostal'].") vers ".$dest['nomvile']." (".$dest['codepostal'].") proposé par : $login</p></td>";
|
||||||
$source = getDepart($db, $codetrajet);
|
echo "<td><a href='reserver.php?codetrajet=$codetrajet'>Réserver</a></td>";
|
||||||
$dest = getFin($db, $codetrajet);
|
echo "</tr>";
|
||||||
$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>";
|
</table>
|
||||||
echo "<td><a href='reserver.php?codetrajet=$codetrajet'>Réserver</a></td>";
|
</div>
|
||||||
echo "</tr>";
|
</div>
|
||||||
}
|
</body>
|
||||||
}
|
</html>
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
@ -1,38 +1,38 @@
|
|||||||
<?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){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return checkReservations($db, $mail, $codetrajet) && checkDatesReserve($db, $mail, $trajet['datedepart']) && checkPlacesVoiture($db, $codetrajet) && strcmp($trajet['mailproposition'], $mail) != 0;
|
$trajet = pg_fetch_array($trajet);
|
||||||
|
if (strcmp($mail, $trajet['mailproposition']) == 0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return checkReservations($db, $mail, $codetrajet) && checkPlacesVoiture($db, $codetrajet);
|
||||||
}
|
}
|
||||||
|
|
||||||
//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'])) { // Test si connecté ou non
|
if (!isset($_SESSION['mail'])) {
|
||||||
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)){ // Test si place dispo et si on peut reserver
|
if (verifierTrajet($db, $mail, $codetrajet) && reserver($db, $mail, $codetrajet)){
|
||||||
reserver($db, $mail, $codetrajet);
|
header('Location: ../tableauBord/tableauBord.php');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
header('Location: ../recherche/recherche.php?error=1');
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: ../tableauBord/tableauBord.php');
|
|
||||||
exit();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
@ -42,13 +42,13 @@ html, body{
|
|||||||
}
|
}
|
||||||
|
|
||||||
body{
|
body{
|
||||||
|
background-attachment: fixed;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background-image: url("../ressources/image/background.jpg");
|
background-image: url("../ressources/image/background.jpg");
|
||||||
background-size : cover;
|
background-size : cover;
|
||||||
background-position: center, center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#formulaire{
|
#formulaire{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
session_start();
|
session_start();
|
||||||
require_once('../connexionBD.php');
|
require_once('../connexionBD.php');
|
||||||
require_once ('../ressources/user.php');
|
require_once ('../ressources/user.php');
|
||||||
require_once ('../ressources/verifconnecte.php');
|
|
||||||
require_once ('../ressources/voiture.php');
|
require_once ('../ressources/voiture.php');
|
||||||
|
|
||||||
$matricule = isset($_POST['matricule']) ? $_POST['matricule'] : NULL; //recuperation valeur formulaire, isset pour eviter l'erreur "Notice: Undefined index"
|
$matricule = isset($_POST['matricule']) ? $_POST['matricule'] : NULL; //recuperation valeur formulaire, isset pour eviter l'erreur "Notice: Undefined index"
|
||||||
@ -11,7 +10,13 @@ $modele = isset($_POST['modele']) ? $_POST['modele'] : NULL;
|
|||||||
$nbplaces = isset($_POST['nbplaces']) ? $_POST['nbplaces'] : NULL;
|
$nbplaces = isset($_POST['nbplaces']) ? $_POST['nbplaces'] : NULL;
|
||||||
$anneefab = isset($_POST['anneefab']) ? $_POST['anneefab'] : NULL;
|
$anneefab = isset($_POST['anneefab']) ? $_POST['anneefab'] : NULL;
|
||||||
|
|
||||||
if (isset($_POST['submitadd'])) { //si formulaire pressé appele la methode
|
if (!isset($_SESSION['mail'])) {
|
||||||
|
header('Location: index.php');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$mail = $_SESSION['mail'];
|
||||||
|
|
||||||
|
if (isset($_POST['submitadd'])) {
|
||||||
$result = pg_query_params($db, "SELECT COUNT(*), matricule FROM voiture WHERE mail = $1 GROUP BY matricule;", array($mail));
|
$result = pg_query_params($db, "SELECT COUNT(*), matricule FROM voiture WHERE mail = $1 GROUP BY matricule;", array($mail));
|
||||||
$row = pg_fetch_array($result);
|
$row = pg_fetch_array($result);
|
||||||
if($row[0] == 0){
|
if($row[0] == 0){
|
||||||
@ -29,12 +34,12 @@ if (!$user){
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['login']) || isset($_FILES['avatar'])){ //si connecte ou si avatar de defini
|
if (isset($_POST['login']) || isset($_FILES['avatar'])){
|
||||||
if (isset($_FILES['avatar']) and !empty($_FILES['avatar']['name'])) { //si avatar et pas de fichier au nom de l'utilisateur
|
if (isset($_FILES['avatar']) and !empty($_FILES['avatar']['name'])) {
|
||||||
$fic = $_FILES['avatar']; //avatar envoyé par l'utilisateur
|
$fic = $_FILES['avatar'];
|
||||||
supprimerAvatar($mail); //supprime l'avatar courant de l'utilisateur
|
supprimerAvatar($mail);
|
||||||
$res = uploadAvatar($mail, $fic); //enregistre l'avatar avec le mail de l'utilisateur
|
$res = uploadAvatar($mail, $fic);
|
||||||
switch ($res){ //controle d'erreur de la fonction uploadAvatar
|
switch ($res){
|
||||||
case -1:
|
case -1:
|
||||||
header('Location: profil.php?error=4');
|
header('Location: profil.php?error=4');
|
||||||
exit();
|
exit();
|
||||||
@ -46,14 +51,14 @@ if (isset($_POST['login']) || isset($_FILES['avatar'])){ //si connecte ou si ava
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($_POST['login']) && isset($_POST['password']) && isset($_POST['confirmation']) && isset($_POST['prenom']) && isset($_POST['nom']) && isset($_POST['phone'])) { //controle du remplissage du formulaire
|
if (isset($_POST['login']) && isset($_POST['password']) && isset($_POST['confirmation']) && isset($_POST['prenom']) && isset($_POST['nom']) && isset($_POST['phone'])) {
|
||||||
$login = htmlentities(pg_escape_string($_POST['login'])); //recupere la variable du formulaire
|
$login = htmlentities(pg_escape_string($_POST['login']));
|
||||||
$password = htmlentities(pg_escape_string($_POST['password']));
|
$password = htmlentities(pg_escape_string($_POST['password']));
|
||||||
$confirmation = htmlentities(pg_escape_string($_POST['confirmation']));
|
$confirmation = htmlentities(pg_escape_string($_POST['confirmation']));
|
||||||
$prenom = htmlentities(pg_escape_string($_POST['prenom']));
|
$prenom = htmlentities(pg_escape_string($_POST['prenom']));
|
||||||
$nom = htmlentities(pg_escape_string($_POST['nom']));
|
$nom = htmlentities(pg_escape_string($_POST['nom']));
|
||||||
$phone = htmlentities(pg_escape_string($_POST['phone']));
|
$phone = htmlentities(pg_escape_string($_POST['phone']));
|
||||||
|
//Si le login a change on le modifie
|
||||||
if (loginChange($user, $login)) {
|
if (loginChange($user, $login)) {
|
||||||
if (!isLoginUniqueModifier($db, $mail, $login)) {
|
if (!isLoginUniqueModifier($db, $mail, $login)) {
|
||||||
header('Location: profil.php?error=1');
|
header('Location: profil.php?error=1');
|
||||||
@ -70,7 +75,7 @@ if (isset($_POST['login']) || isset($_FILES['avatar'])){ //si connecte ou si ava
|
|||||||
header('Location: profil.php?error=2');
|
header('Location: profil.php?error=2');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
//Modifier l'utilisateur et afficher un message d'erreur si erreur
|
||||||
if (!modifierUtilisateur($db, $mail, $prenom, $nom, $password, $phone)) {
|
if (!modifierUtilisateur($db, $mail, $prenom, $nom, $password, $phone)) {
|
||||||
header('Location: profil.php?error=6');
|
header('Location: profil.php?error=6');
|
||||||
exit();
|
exit();
|
||||||
@ -165,7 +170,11 @@ if (isset($_POST['login']) || isset($_FILES['avatar'])){ //si connecte ou si ava
|
|||||||
<label for="avatar">Image du Profil :</label>
|
<label for="avatar">Image du Profil :</label>
|
||||||
<input type="file" id="avatar" class="form" name="avatar" accept="image/png, image/jpeg">
|
<input type="file" id="avatar" class="form" name="avatar" accept="image/png, image/jpeg">
|
||||||
</div>
|
</div>
|
||||||
<?php getErrorProfil($_GET['error']); ?>
|
<?php
|
||||||
|
if (isset($_GET['error'])){
|
||||||
|
echo "<p class='error'>".getErrorProfil($_GET['error'])."</p>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
<input id="submit" class="button" type="submit" value="Modifier">
|
<input id="submit" class="button" type="submit" value="Modifier">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,40 +1,91 @@
|
|||||||
.centrage {
|
*{
|
||||||
text-align: center;
|
font-family: "Arial";
|
||||||
font-size: 20px;
|
padding: 0;
|
||||||
}
|
|
||||||
|
|
||||||
.global {
|
|
||||||
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
br {
|
|
||||||
line-height: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
color: black;
|
|
||||||
background-color: white;
|
|
||||||
background-image: url("../ressources/image/background.jpg");
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: 104%;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#container {
|
body{
|
||||||
margin: 5% 15% 2% 15%;
|
background-attachment: fixed;
|
||||||
|
background-image:url("../ressources/image/background.jpg");
|
||||||
|
background-size: cover;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container{
|
||||||
|
margin-top: 3em;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1{
|
||||||
|
font-size: 2em;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.villeSelect, .villeText{
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-bottom: 0.7em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.villeText{
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.villeSelect{
|
||||||
|
margin-bottom: 0.7em;
|
||||||
|
margin-left: 2%;
|
||||||
|
width: 33%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#submit{
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-left: 50%;
|
||||||
|
transform: translate(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
#formulaire{
|
||||||
background-color: white;
|
background-color: white;
|
||||||
border: 2px solid black;
|
border-radius: 10px;
|
||||||
|
padding: 4em;
|
||||||
|
width: 40%;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
.form{
|
||||||
text-align: center;
|
box-sizing: border-box;
|
||||||
font-size: 250%;
|
width: 55%;
|
||||||
|
margin-bottom: 0.7em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#form {
|
.button{
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 8px;
|
||||||
|
color: white;
|
||||||
|
background-color: rgb(65, 154, 28);
|
||||||
|
border-radius: 5em;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line{
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: left;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error{
|
||||||
|
margin-top: 1em;
|
||||||
|
color: red;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.label{
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 1.1em;
|
||||||
|
width: 45%;
|
||||||
|
min-width: 8em;
|
||||||
|
}
|
||||||
|
23
WEB/recherche/recherche.js
Normal file
23
WEB/recherche/recherche.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
$(document).ready(function () {
|
||||||
|
//Copier les options
|
||||||
|
let options = $('#villeDepart option').clone();
|
||||||
|
$('#villeDepartText').keyup(function () {
|
||||||
|
let val = $(this).val().toString().toLowerCase();
|
||||||
|
$('#villeDepart').empty();
|
||||||
|
//Récuperer les option filtrées ou toutes les options si vide
|
||||||
|
options.filter(function (idx, el) {
|
||||||
|
return val === '' || $(el).text().toLowerCase().indexOf(val) >= 0;
|
||||||
|
}).appendTo('#villeDepart');//ajouter à la liste
|
||||||
|
});
|
||||||
|
|
||||||
|
//Copier les options
|
||||||
|
let optionsArrive = $('#villeArrive option').clone();
|
||||||
|
$('#villeArriveText').keyup(function () {
|
||||||
|
let val = $(this).val().toString().toLowerCase();
|
||||||
|
$('#villeArrive').empty();
|
||||||
|
//Récuperer les option filtrées ou toutes les options si vide
|
||||||
|
optionsArrive.filter(function (idx, el) {
|
||||||
|
return val === '' || $(el).text().toLowerCase().indexOf(val) >= 0;
|
||||||
|
}).appendTo('#villeArrive');//ajouter à la liste
|
||||||
|
});
|
||||||
|
});
|
@ -1,6 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
function getError($code)
|
||||||
|
{
|
||||||
|
switch ($code) {
|
||||||
|
case 1:
|
||||||
|
return "Impossible de réserver ce trajet";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
require_once('../ressources/verifconnecte.php');
|
require_once('../ressources/verifconnecte.php');
|
||||||
|
require_once('../ressources/trajet.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -17,38 +27,44 @@ require_once('../ressources/verifconnecte.php');
|
|||||||
require_once("../ressources/navbarhtml.php");
|
require_once("../ressources/navbarhtml.php");
|
||||||
?>
|
?>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<div id="entete">
|
<div id="formulaire">
|
||||||
<h1>Rechercher trajet</h1><br/>
|
<h1>Rechercher trajet</h1>
|
||||||
</div>
|
|
||||||
<div class="global bord">
|
|
||||||
<form method="post" action="../liste_trajets/liste_trajet.php">
|
<form method="post" action="../liste_trajets/liste_trajet.php">
|
||||||
|
<div class="line">
|
||||||
<label>
|
<label class="label" for="villeDepart">Ville de départ : </label>
|
||||||
<input name="lieu_depart" type="text" placeholder="Lieu de départ" class="centrage" required>
|
<input type="text" class="form, villeText" name="villeDepartText" id="villeDepartText">
|
||||||
<br/>
|
<select class="form, villeSelect" name="villeDepart" id="villeDepart" required>
|
||||||
<br/>
|
<option selected></option>
|
||||||
</label>
|
<?php afficherVilles($db); ?>
|
||||||
|
</select>
|
||||||
<label>
|
</div>
|
||||||
<input name="lieu_arrivee" type="text" placeholder="Lieu d'arrivée" class="centrage" required>
|
<div id="villeEtapeDiv" class="line">
|
||||||
<br/>
|
<label class="label" for="villeArrive">Etape : </label>
|
||||||
<br/>
|
<input type="text" class="form, villeText" id="villeArriveText" name="villeArriveText">
|
||||||
</label>
|
<select class="form, villeSelect" name="villeArrive" id="villeArrive" required>
|
||||||
|
<option selected></option>
|
||||||
<label>
|
<?php afficherVilles($db); ?>
|
||||||
<input name="date_heure" type="date" placeholder="Date et heure de départ" class="centrage"
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="line">
|
||||||
|
<label class="label" for="date">Date départ : </label>
|
||||||
|
<input id="date" class="form" name="date_heure" type="date" placeholder="Date et heure de départ" class="centrage"
|
||||||
required>
|
required>
|
||||||
<br/>
|
</div>
|
||||||
</label>
|
|
||||||
<br/>
|
<br/>
|
||||||
<label>
|
<label>
|
||||||
<input id="submit" name="submit" type="submit" value="Rechercher" class="centrage">
|
<input id="submit" class="button" name="submit" type="submit" value="Rechercher" required>
|
||||||
</label>
|
</label>
|
||||||
</form>
|
</form>
|
||||||
|
<?php
|
||||||
|
if (isset($_GET['error'])) {
|
||||||
|
echo "<p class='error'>" . getError($_GET['error']) . "</p>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
<script type="application/javascript" src="../ressources/libs/jquery-3.4.1.js"></script>
|
||||||
|
<script type="application/javascript" src="../ressources/libs/jquery-ui.min.js"></script>
|
||||||
|
<script src="recherche.js"></script>
|
||||||
</html>
|
</html>
|
||||||
|
@ -7,7 +7,7 @@ function getListeVilles($db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reserver($db, $mail, $codetrajet){
|
function reserver($db, $mail, $codetrajet){
|
||||||
return pg_query_params($db, "INSERT INTO Reserver VALUES ($1, $2, $3);", array($mail, $codetrajet, date('Y-m-d H:i:s')));
|
return pg_query_params($db, "INSERT INTO Reserver VALUES ($1, $2, false, $3);", array($mail, $codetrajet, date('Y-m-d H:i:s')));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTrajet($db, $codetrajet)
|
function getTrajet($db, $codetrajet)
|
||||||
@ -37,12 +37,18 @@ function creerEtapes($db, $codeTrajet, $etapes)
|
|||||||
//Vérifier la cohérence des dates
|
//Vérifier la cohérence des dates
|
||||||
function checkDates($db, $mail, $dateDepart, $dateArrivee)
|
function checkDates($db, $mail, $dateDepart, $dateArrivee)
|
||||||
{
|
{
|
||||||
$valide = $dateDepart < $dateArrivee && $dateDepart > date('Y-m-d H:i:s');
|
$valide = $dateDepart <= $dateArrivee && $dateDepart >= date('Y-m-d H:i:s');
|
||||||
$result = pg_query_params($db, "SELECT COUNT(*) From Trajet WHERE mailproposition = $1 AND $2 BETWEEN datedepart AND datearrivee;", array($mail, $dateDepart));
|
$result = pg_query_params($db, "SELECT COUNT(*) From Trajet WHERE mailproposition = $1 AND estannule = false AND $2 BETWEEN datedepart AND datearrivee;", array($mail, $dateDepart));
|
||||||
$row = pg_fetch_array($result);
|
$row = pg_fetch_array($result);
|
||||||
return $row[0] == 0 && $valide;
|
return $row[0] == 0 && $valide;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Récupérer les étapes d'un trajet
|
||||||
|
function getEtapesTrajet($db, $codetrajet){
|
||||||
|
$result = pg_query_params($db, "SELECT * FROM Traverser WHERE codetrajet = $1 ;", array($codetrajet));
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
//Vérifier le nombre de places restantes
|
//Vérifier le nombre de places restantes
|
||||||
function checkPlacesVoiture($db, $codetrajet)
|
function checkPlacesVoiture($db, $codetrajet)
|
||||||
{
|
{
|
||||||
@ -80,9 +86,10 @@ function checkVoiture($db, $mail, $matricule)
|
|||||||
return !strcmp($matricule, $row[0]);
|
return !strcmp($matricule, $row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Recuperer le nombre de trajets restant proposés par l'utilisateur $mail
|
||||||
function getTrajetsProposes($db, $mail)
|
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 datedepart >= $2;", array($mail, date('Y-m-d H:i:s')));
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$row = pg_fetch_array($result);
|
$row = pg_fetch_array($result);
|
||||||
return $row[0];
|
return $row[0];
|
||||||
@ -90,9 +97,10 @@ function getTrajetsProposes($db, $mail)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Recuperer le nombre de trajets restant reservés par l'utilisateur $mail
|
||||||
function getTrajetsReserves($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 datedepart >= current_date;", 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.datedepart >= $2;", array($mail, date('Y-m-d H:i:s')));
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$row = pg_fetch_array($result);
|
$row = pg_fetch_array($result);
|
||||||
return $row[0];
|
return $row[0];
|
||||||
@ -150,31 +158,35 @@ function afficherVilles($db)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Récuperer la ville de départ du trajet $codetrajet
|
||||||
function getDepart($db, $codetajet)
|
function getDepart($db, $codetajet)
|
||||||
{
|
{
|
||||||
$result = pg_query_params($db, "SELECT v.nomVille FROM ville v, traverser tr WHERE tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.codetrajet = $1 AND tr.numeroetape = (SELECT MIN(numeroetape) FROM traverser WHERE codetrajet = $1);", array($codetajet));
|
$result = pg_query_params($db, "SELECT * FROM ville v, traverser tr WHERE tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.codetrajet = $1 AND tr.numeroetape = (SELECT MIN(numeroetape) FROM traverser WHERE codetrajet = $1);", array($codetajet));
|
||||||
$return = false;
|
$return = false;
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$return = pg_fetch_array($result)[0];
|
$return = pg_fetch_array($result);
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Récuperer la ville d'arrivée du trajet $codetrajet
|
||||||
function getFin($db, $codetajet)
|
function getFin($db, $codetajet)
|
||||||
{
|
{
|
||||||
$result = pg_query_params($db, "SELECT v.nomVille FROM ville v, traverser tr WHERE tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.codetrajet = $1 AND tr.numeroetape = (SELECT MAX(numeroetape) FROM traverser WHERE codetrajet = $1);", array($codetajet));
|
$result = pg_query_params($db, "SELECT * FROM ville v, traverser tr WHERE tr.nomVille = v.nomVille AND tr.codepostal = v.codepostal AND tr.codetrajet = $1 AND tr.numeroetape = (SELECT MAX(numeroetape) FROM traverser WHERE codetrajet = $1);", array($codetajet));
|
||||||
$return = false;
|
$return = false;
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$return = pg_fetch_array($result)[0];
|
$return = pg_fetch_array($result);
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Annuler le trajet $codetrajet
|
||||||
function annulerTrajet($db, $codetrajet){
|
function annulerTrajet($db, $codetrajet){
|
||||||
$result = pg_query_params($db, "UPDATE Trajet SET estannule = true WHERE codetrajet = $1;", array($codetrajet));
|
$result = pg_query_params($db, "UPDATE Trajet SET estannule = true WHERE codetrajet = $1;", array($codetrajet));
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Annuler la reservation pour le tajet $codetrajet de l'utilisateur $mail
|
||||||
function annulerReservation($db, $mail,$codetrajet){
|
function annulerReservation($db, $mail,$codetrajet){
|
||||||
$result = pg_query_params($db, "DELETE FROM reserver WHERE codetrajet = $1 AND mailutilisateur = $2;", array($codetrajet, $mail));
|
$result = pg_query_params($db, "DELETE FROM reserver WHERE codetrajet = $1 AND mailutilisateur = $2;", array($codetrajet, $mail));
|
||||||
return $result;
|
return $result;
|
||||||
@ -194,4 +206,13 @@ function getErrorDepotTrajet($code)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Verifie l'existance d'un avis pour le trajet $codetrajet émit par l'utilisateur $mail
|
||||||
|
function avisExiste($db, $mail, $codetrajet){
|
||||||
|
$result = pg_query_params($db, "SELECT COUNT(*) FROM Avis WHERE mailemetteur = $1 AND codetrajet = $2;", array($mail, $codetrajet));
|
||||||
|
if(!$result){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return pg_fetch_array($result)[0] != 0;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -111,6 +111,7 @@ function getLogin($db, $mail)
|
|||||||
|
|
||||||
function getPathImgProfilTableau($mail)
|
function getPathImgProfilTableau($mail)
|
||||||
{
|
{
|
||||||
|
//Récuperer le fichier contenant $mail dans son nom
|
||||||
$list = scandir("../imageProfil");
|
$list = scandir("../imageProfil");
|
||||||
foreach ($list as $entry) {
|
foreach ($list as $entry) {
|
||||||
if (strpos($entry, $mail) !== false) {
|
if (strpos($entry, $mail) !== false) {
|
||||||
@ -122,6 +123,7 @@ function getPathImgProfilTableau($mail)
|
|||||||
|
|
||||||
function getPathImgProfil($mail)
|
function getPathImgProfil($mail)
|
||||||
{
|
{
|
||||||
|
//Récuperer le fichier contenant $mail dans son nom
|
||||||
$list = scandir("../imageProfil");
|
$list = scandir("../imageProfil");
|
||||||
foreach ($list as $entry) {
|
foreach ($list as $entry) {
|
||||||
if (strpos($entry, $mail) !== false) {
|
if (strpos($entry, $mail) !== false) {
|
||||||
@ -133,6 +135,7 @@ function getPathImgProfil($mail)
|
|||||||
|
|
||||||
function supprimerAvatar($mail)
|
function supprimerAvatar($mail)
|
||||||
{
|
{
|
||||||
|
//Supprimer le fichier contenant $mail dans son nom
|
||||||
$list = scandir("../imageProfil");
|
$list = scandir("../imageProfil");
|
||||||
foreach ($list as $entry) {
|
foreach ($list as $entry) {
|
||||||
if (strpos($entry, $mail) !== false) {
|
if (strpos($entry, $mail) !== false) {
|
||||||
@ -188,6 +191,7 @@ function uploadAvatar($mail, $fic)
|
|||||||
|
|
||||||
function deluser($db, $delmail)
|
function deluser($db, $delmail)
|
||||||
{
|
{
|
||||||
|
//Remplacer le mail de l'utilisateur à supprimer par l'utilisateur utilisateur_supprime@local
|
||||||
$requete = "UPDATE trajet SET mailproposition = $1 WHERE mailproposition = $2;";
|
$requete = "UPDATE trajet SET mailproposition = $1 WHERE mailproposition = $2;";
|
||||||
$result1 = pg_query_params($db, $requete, array('utilisateur_supprime@local', $delmail));
|
$result1 = pg_query_params($db, $requete, array('utilisateur_supprime@local', $delmail));
|
||||||
$requete = "UPDATE reserver SET mailutilisateur = $1 WHERE mailutilisateur = $2;";
|
$requete = "UPDATE reserver SET mailutilisateur = $1 WHERE mailutilisateur = $2;";
|
||||||
@ -196,6 +200,7 @@ function deluser($db, $delmail)
|
|||||||
$result3 = pg_query_params($db, $requete, array($delmail));
|
$result3 = pg_query_params($db, $requete, array($delmail));
|
||||||
$requete = "UPDATE voiture SET mail = $1 WHERE mail = $2;";
|
$requete = "UPDATE voiture SET mail = $1 WHERE mail = $2;";
|
||||||
$result4 = pg_query_params($db, $requete, array('utilisateur_supprime@local', $delmail));
|
$result4 = pg_query_params($db, $requete, array('utilisateur_supprime@local', $delmail));
|
||||||
|
//Supprimer l'utilisateur $mail
|
||||||
$requete = "DELETE FROM utilisateur WHERE mail = $1;";
|
$requete = "DELETE FROM utilisateur WHERE mail = $1;";
|
||||||
$result5 = pg_query_params($db, $requete, array($delmail));
|
$result5 = pg_query_params($db, $requete, array($delmail));
|
||||||
return $result1 && $result2 && $result3 && $result4 && $result5;
|
return $result1 && $result2 && $result3 && $result4 && $result5;
|
||||||
|
@ -1,16 +1,22 @@
|
|||||||
*{
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-family: "Arial";
|
font-family: "Arial";
|
||||||
}
|
}
|
||||||
|
|
||||||
h1{
|
body {
|
||||||
|
background-image: url("../ressources/image/background.jpg");
|
||||||
|
background-size: cover;
|
||||||
|
background-attachment: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
font-size: 3em;
|
font-size: 3em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content{
|
#content {
|
||||||
min-width: 320px;
|
min-width: 320px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -19,20 +25,22 @@ h1{
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tableauBord{
|
#tableauBord {
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: white;
|
||||||
margin: 2em;
|
margin: 2em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
width: 100%;
|
width: 70%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#divImgProfil{
|
#divImgProfil {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#imgProfil{
|
#imgProfil {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
margin-top: 2.5em;
|
margin-top: 2.5em;
|
||||||
width: 60%;
|
width: 60%;
|
||||||
@ -42,7 +50,22 @@ h1{
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#trajet{
|
.button{
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 12px;
|
||||||
|
color: white;
|
||||||
|
background-color: rgb(65, 154, 28);
|
||||||
|
border-radius: 5em;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover{
|
||||||
|
background-color: rgb(80, 174, 48);
|
||||||
|
}
|
||||||
|
|
||||||
|
#trajet {
|
||||||
margin-top: 2em;
|
margin-top: 2em;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@ -52,35 +75,18 @@ h1{
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btnTrajet{
|
#btnTrajet2 {
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
text-decoration: none;
|
|
||||||
padding: 0.4em;
|
|
||||||
color: black;
|
|
||||||
background-color: lightgray;
|
|
||||||
border: 1px solid black;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.btnTrajet:hover{
|
|
||||||
background-color: grey;
|
|
||||||
}
|
|
||||||
|
|
||||||
#btnTrajet2{
|
|
||||||
margin-left: 10%;
|
margin-left: 10%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#recap{
|
#recap {
|
||||||
margin-top: 2.5em;
|
margin-top: 2.5em;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
margin-left: 50%;
|
margin-left: 50%;
|
||||||
transform: translate(-50%);
|
transform: translate(-50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.recapLine{
|
.recapLine {
|
||||||
margin-bottom: 1.5em;
|
margin-bottom: 1.5em;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
@ -89,11 +95,11 @@ h1{
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recapIcon{
|
.recapIcon {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
p{
|
p {
|
||||||
margin-left: 10%;
|
margin-left: 10%;
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ require_once ('../ressources/verifconnecte.php');
|
|||||||
<img id="imgProfil" src="<?php echo getPathImgProfilTableau($mail); ?>">
|
<img id="imgProfil" src="<?php echo getPathImgProfilTableau($mail); ?>">
|
||||||
</div>
|
</div>
|
||||||
<div id="trajet">
|
<div id="trajet">
|
||||||
<a class="btnTrajet" href="../deposerTrajet/depotTrajet.php">Déposer un trajet</a>
|
<a class="button" href="../deposerTrajet/depotTrajet.php">Déposer un trajet</a>
|
||||||
<a id="btnTrajet2" class="btnTrajet" href="../recherche/recherche.php">Rechercher un trajet</a>
|
<a id="btnTrajet2" class="button" href="../recherche/recherche.php">Rechercher un trajet</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="recap">
|
<div id="recap">
|
||||||
<div class="recapLine">
|
<div class="recapLine">
|
||||||
|
Loading…
Reference in New Issue
Block a user