Compare commits
61 Commits
messagerie
...
master
Author | SHA1 | Date |
---|---|---|
Flavien Haas | c139f83edf | 6 years ago |
PALAFFRE Raphaël | 0d256c60ef | 6 years ago |
PALAFFRE Raphaël | 6e0465379e | 6 years ago |
PALAFFRE Raphaël | 77796e4df8 | 6 years ago |
PALAFFRE Raphaël | 13064316fd | 6 years ago |
PALAFFRE Raphaël | 508c84a04f | 6 years ago |
PALAFFRE Raphaël | bd4163c5fa | 6 years ago |
PALAFFRE Raphaël | 7c73030e97 | 6 years ago |
PALAFFRE Raphaël | 598feef1f7 | 6 years ago |
PALAFFRE Raphaël | 65b1254997 | 6 years ago |
remi.biette | 78eac17d42 | 6 years ago |
remi.biette | c8308b0504 | 6 years ago |
remi.biette | 5d6c29070f | 6 years ago |
remi.biette | 4eafe9558d | 6 years ago |
Flavien Haas | 58e5e866a9 | 6 years ago |
Flavien Haas | 101d9dd428 | 6 years ago |
Flavien Haas | 9801d58650 | 6 years ago |
Flavien Haas | 0ea54d359d | 6 years ago |
remi.biette | 4014c82df5 | 6 years ago |
Flavien Haas | d30839192c | 6 years ago |
Flavien Haas | a92937be62 | 6 years ago |
Flavien Haas | 1a55ad8382 | 6 years ago |
Flavien Haas | af17c6dad9 | 6 years ago |
Flavien Haas | 5f62efd208 | 6 years ago |
Flavien Haas | 00cd26f499 | 6 years ago |
Flavien Haas | 35f2d6163c | 6 years ago |
Flavien Haas | ed1bd41e66 | 6 years ago |
Flavien Haas | 11e0e4f486 | 6 years ago |
raphael.palaffre | ed027f92d0 | 6 years ago |
remi.biette | cbb507a70b | 6 years ago |
remi.biette | 08f263e3c7 | 6 years ago |
Flavien Haas | 4ea87ca98a | 6 years ago |
Flavien Haas | c63d1b76db | 6 years ago |
Flavien Haas | 0158d822c1 | 6 years ago |
Flavien Haas | 62d31524a1 | 6 years ago |
raphael.palaffre | d0cb654525 | 6 years ago |
Flavien Haas | 24ddc892c5 | 6 years ago |
Flavien Haas | b002969806 | 6 years ago |
remi.biette | fe89b5b7f6 | 6 years ago |
remi.biette | c50c46e1d2 | 6 years ago |
remi.biette | 934a601284 | 6 years ago |
remi.biette | c53f87c82f | 6 years ago |
remi.biette | 6b1e6bf907 | 6 years ago |
remi.biette | 07049eaf25 | 6 years ago |
remi.biette | 3ac061f06f | 6 years ago |
remi.biette | 17aba86405 | 6 years ago |
remi.biette | 6c27f3875d | 6 years ago |
raphael.palaffre | ee93cea874 | 6 years ago |
Flavien Haas | 6a038c8048 | 6 years ago |
Flavien Haas | c10f43f1e5 | 6 years ago |
Flavien Haas | f9410e6bdd | 6 years ago |
remi.biette | eda70327ac | 6 years ago |
remi.biette | a81a2169fe | 6 years ago |
remi.biette | 31196609a4 | 6 years ago |
remi.biette | 551859e697 | 6 years ago |
remi.biette | 158d2825e0 | 6 years ago |
Flavien Haas | 2ab4061db9 | 6 years ago |
Flavien Haas | a2e72de86c | 6 years ago |
remi.biette | a682ee2890 | 6 years ago |
Flavien Haas | 1bbc5eaf76 | 6 years ago |
Flavien Haas | d13f485dfa | 6 years ago |
@ -1,34 +0,0 @@
|
||||
.centrage{
|
||||
text-align : center;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.global {
|
||||
position: absolute; /* postulat de départ */
|
||||
top: 45%; left: 50%; /* à 50%/50% du parent référent */
|
||||
transform: translate(-50%, -50%); /* décalage de 50% de sa propre taille */
|
||||
text-align : center;
|
||||
|
||||
}
|
||||
|
||||
.fort {
|
||||
|
||||
font-weight: bold;
|
||||
text-align : center;
|
||||
text-decoration: underline;
|
||||
font-size : 30px;
|
||||
|
||||
}
|
||||
|
||||
.bord{
|
||||
|
||||
border-radius: 20px;
|
||||
border-left: 2px solid black;
|
||||
border-right: 2px solid black;
|
||||
border-top: 2px solid black;
|
||||
border-bottom: 2px solid black;
|
||||
padding : 20px 80px 60px 80px;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="Recherche.css" />
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
|
||||
<div class="global bord">
|
||||
|
||||
<p class="fort">Rechercher un trajet</p>
|
||||
|
||||
<form method="post" action="Liste.php">
|
||||
|
||||
<p>
|
||||
|
||||
<input name="lieu_depart" type="text" placeholder="Lieu de départ" class="centrage">
|
||||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
<input name="lieu_arrivée" type="text" placeholder="Lieu d'arrivée" class="centrage" >
|
||||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
<input name="date_heure" type="text" placeholder="Date et heure de départ" class="centrage" >
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
|
||||
<input name="submit" type="submit" value="Rechercher" class="centrage">
|
||||
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang = "fr">
|
||||
<head>
|
||||
<meta charset = "UTF-8">
|
||||
<link rel = "stylesheet" href = "avis_laisse.css">
|
||||
<title>Liste des trajets</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id = "container">
|
||||
|
||||
<div id ="entete">
|
||||
<a href = "LIEN TABLEAU DE BORD"><img id = "bouton_retour" src = "return.png" alt = "Bouton retour"></a>
|
||||
<h1 class = "float" id = "titre">Avis laissés</h1>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div id = "liste">
|
||||
<hr class="separation" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,44 @@
|
||||
/*General*/
|
||||
|
||||
body {
|
||||
color:black;
|
||||
background-color:white;
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
background-repeat:no-repeat;
|
||||
background-size:100%;
|
||||
margin: 0;
|
||||
font-family: Ubuntu,Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin : 5% 5% 5% 5%;
|
||||
background-color : white;
|
||||
border : 2px solid black;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align : center;
|
||||
font-size : 250%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2{
|
||||
text-align : center;
|
||||
font-size : 150%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*Affichage avis*/
|
||||
|
||||
#bouton_retour{
|
||||
transform : rotate(45deg);
|
||||
}
|
||||
|
||||
.etoile{
|
||||
height:50px;
|
||||
}
|
||||
|
||||
.avis_tab{
|
||||
width:85%;
|
||||
padding-left:15%;
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
//Importation des fichiers necessaires au fonctionnement
|
||||
session_start();
|
||||
require_once ("../connexionBD.php");
|
||||
require_once ("../ressources/user.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
//Recuperation de la variables de session
|
||||
$mail = $_SESSION['mail'];
|
||||
|
||||
$login = getLogin($db,$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;";
|
||||
$result = pg_query_params($db, $requete, array($mail));
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang = "fr">
|
||||
|
||||
<head>
|
||||
<meta charset = "UTF-8">
|
||||
<link rel = "stylesheet" href = "avis_laisses.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico" />
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css" />
|
||||
<title>Avis Laissés</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
||||
|
||||
<div id = "container">
|
||||
|
||||
<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>
|
||||
<h1 id = "titre">Avis Laissés</h1>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div id = "avis">
|
||||
<table>
|
||||
<?php
|
||||
while ($row = pg_fetch_array($result)) { //Stockage des resultats des requete SQL
|
||||
$nom = $row['login'];
|
||||
$date = $row['dateavis'];
|
||||
$commentaire = $row['commentaire'];
|
||||
$note = $row['note'];
|
||||
echo "<tr>";
|
||||
echo "<td class='avis_tab'>"; //Affichage sous forme de tableau pour la mise en page
|
||||
echo "<h3 id='nom'>$nom</h3>";
|
||||
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
|
||||
echo "<h5 id='avis'>$commentaire</h5>";
|
||||
echo "</td>";
|
||||
echo "<td id='note_tab'>";
|
||||
$i=0;
|
||||
while ($i<intval($note)){ //Affichage de la note laisses
|
||||
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
$i = $note;
|
||||
while ($i<3){
|
||||
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 42 KiB |
@ -0,0 +1,44 @@
|
||||
/*General*/
|
||||
|
||||
body {
|
||||
color:black;
|
||||
background-color:white;
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
background-repeat:no-repeat;
|
||||
background-size:104%;
|
||||
margin: 0;
|
||||
font-family: Ubuntu,Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin : 5% 5% 5% 5%;
|
||||
background-color : white;
|
||||
border : 2px solid black;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align : center;
|
||||
font-size : 250%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2{
|
||||
text-align : center;
|
||||
font-size : 150%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*Affichage avis*/
|
||||
|
||||
#bouton_retour{
|
||||
transform : rotate(45deg);
|
||||
}
|
||||
|
||||
.etoile{
|
||||
height:50px;
|
||||
}
|
||||
|
||||
.avis_tab{
|
||||
width:85%;
|
||||
padding-left:15%;
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
//Importation des fichiers
|
||||
session_start();
|
||||
require_once("../connexionBD.php");
|
||||
require_once("../ressources/user.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
//Recuperation variable session
|
||||
$mail = $_SESSION['mail'];
|
||||
|
||||
$login = getLogin($db, $mail);
|
||||
|
||||
//Creation et envoie de la requete SQL
|
||||
|
||||
$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;";
|
||||
$result = pg_query_params($db, $requete, array($mail));
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="avis_recus.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Avis Recus</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 id="titre">Avis Recus</h1>
|
||||
<br>
|
||||
</div>
|
||||
<div id="avis"> <-- Avis recus -->
|
||||
<table>
|
||||
<?php while ($row = pg_fetch_array($result)) { //Stockage des valeurs de retour de la requete SQL
|
||||
$nom = $row['login'];
|
||||
$date = $row['dateavis'];
|
||||
$commentaire = $row['commentaire'];
|
||||
$note = $row['note'];
|
||||
echo "<tr>"; //Affichage des resultat sour forme de tableau
|
||||
echo "<td class='avis_tab'>";
|
||||
echo "<h3 id='nom'>$nom</h3>";
|
||||
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
|
||||
echo "<h5 id='avis'>$commentaire</h5>";
|
||||
echo "</td>";
|
||||
echo "<td id='note_tab'>";
|
||||
$i=0;
|
||||
while ($i<intval($note)){ //Affichage des notes recus
|
||||
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
$i = $note;
|
||||
while ($i<3){
|
||||
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
|
||||
$i++;
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: REMI
|
||||
* Date: 16/04/2019
|
||||
* Time: 14:46
|
||||
*/
|
||||
|
||||
|
||||
function connexionBD(){
|
||||
$host = "localhost";
|
||||
$dbname = "projet";
|
||||
$user = "utilisateur";
|
||||
$pass = "-stri-";
|
||||
$db = pg_connect("host=$host port=5432 dbname=$dbname user=$user password=$pass") or die("Erreur lors de la connexion à la base de données.");
|
||||
return $db;
|
||||
}
|
||||
?>
|
||||
|
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$host = "localhost";
|
||||
$dbname = "projet";
|
||||
$user = "utilisateur";
|
||||
$pass = "-stri-";
|
||||
$db = pg_connect("host=$host port=5432 dbname=$dbname user=$user password=$pass") or die("Erreur lors de la connexion à la base de données.");
|
||||
?>
|
@ -1,21 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: REMI
|
||||
* Date: 19/04/2019
|
||||
* Time: 10:10
|
||||
*/
|
||||
|
||||
require 'connectionBD.php';
|
||||
$db = connexionBD();
|
||||
init();
|
||||
require_once ('connexionBD.php');
|
||||
|
||||
function init(){
|
||||
session_start();
|
||||
if (isset($_SESSION['mail'])){
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['mail'])){
|
||||
session_unset();
|
||||
session_destroy();
|
||||
}
|
||||
header('Location: index.php');
|
||||
exit();
|
||||
}
|
||||
header('Location: index.php');
|
@ -0,0 +1,96 @@
|
||||
*{
|
||||
font-family: "Arial";
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body{
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
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%;
|
||||
}
|
||||
|
||||
#supprimerEtape{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#boutonEtape{
|
||||
margin-top: 1.5em;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
#submit{
|
||||
margin-top: 1em;
|
||||
margin-left: 50%;
|
||||
transform: translate(-50%);
|
||||
}
|
||||
|
||||
#formulaire{
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
padding: 4em;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.form{
|
||||
box-sizing: border-box;
|
||||
width: 55%;
|
||||
margin-bottom: 0.7em;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.label{
|
||||
box-sizing: border-box;
|
||||
font-size: 1.1em;
|
||||
width: 45%;
|
||||
min-width: 8em;
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
$(document).ready(function () {
|
||||
//copy options
|
||||
let options = $('#villeDepart option').clone();
|
||||
//react on keyup in textbox
|
||||
$('#villeDepartText').keyup(function () {
|
||||
let val = $(this).val().toString().toLowerCase();
|
||||
$('#villeDepart').empty();
|
||||
//take only the options containing your filter text or all if empty
|
||||
options.filter(function (idx, el) {
|
||||
return val === '' || $(el).text().toLowerCase().indexOf(val) >= 0;
|
||||
}).appendTo('#villeDepart');//add it to list
|
||||
});
|
||||
|
||||
//copy options
|
||||
let optionsEtape = $('#villeEtape option').clone();
|
||||
//react on keyup in textbox
|
||||
$('#villeEtapeText').keyup(function () {
|
||||
let val = $(this).val().toString().toLowerCase();
|
||||
$('#villeEtape').empty();
|
||||
//take only the options containing your filter text or all if empty
|
||||
optionsEtape.filter(function (idx, el) {
|
||||
return val === '' || $(el).text().toLowerCase().indexOf(val) >= 0;
|
||||
}).appendTo('#villeEtape');//add it to list
|
||||
});
|
||||
|
||||
$("#ajoutEtape").click(function () {
|
||||
let depart = $("#villeDepart");
|
||||
let etape = $("#villeEtape");
|
||||
let nbEtape = $("#nbEtapes");
|
||||
if(etape.val() != null && etape.val() !== "" && depart.val() != null && depart.val() !== ""){
|
||||
let option = $("#villeEtape option:selected");
|
||||
let numero = (parseInt(nbEtape.val()));
|
||||
$(this).parent().before("<div class='line etape'>" +
|
||||
"<lablel class='label' for='etape" + numero + "'>Etape " + numero + " :</lablel>" +
|
||||
"<input type='text' class='form' value='" + option.text() + "' readonly>" +
|
||||
"<input type='hidden' name='etape" + numero + "' value='" + option.val() + "' readonly></div>");
|
||||
nbEtape.attr('value', parseInt(nbEtape.val())+1);
|
||||
//$("#supprimerEtape").css("display", "initial");
|
||||
$("#supprimerEtape").show();
|
||||
}
|
||||
});
|
||||
|
||||
$("#supprimerEtape").click(function () {
|
||||
let etape = $(".etape:last");
|
||||
let nbEtape = $("#nbEtapes");
|
||||
if (parseInt(nbEtape.val())>0){
|
||||
etape.remove();
|
||||
nbEtape.attr('value', parseInt(nbEtape.val())-1);
|
||||
if (parseInt(nbEtape.val())<=1){
|
||||
//$("#supprimerEtape").css("display", "none");
|
||||
$("#supprimerEtape").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once('../connexionBD.php');
|
||||
require_once('../ressources/trajet.php');
|
||||
require_once ('../ressources/verifconnecte.php');
|
||||
|
||||
//Tester que tous les champs ont été renseignés
|
||||
if (isset($_POST['dateDepart']) && isset($_POST['dateArrivee']) && isset($_POST['voiture']) && isset($_POST['villeDepart']) && isset($_POST['nbEtapes']) && isset($_POST['etape1'])) {
|
||||
//Récupérer tous les $_POST en variables
|
||||
$nbEtapes = htmlspecialchars(pg_escape_string($_POST['nbEtapes']));
|
||||
$dateDepart = htmlspecialchars(pg_escape_string($_POST['dateDepart']));
|
||||
$dateArrivee = htmlspecialchars(pg_escape_string($_POST['dateArrivee']));
|
||||
$voiture = htmlspecialchars(pg_escape_string($_POST['voiture']));
|
||||
$villeDepart = htmlspecialchars(pg_escape_string($_POST['villeDepart']));
|
||||
$arrEtapes = array();
|
||||
$i=1;
|
||||
//Ajouter les étapes à un tableau
|
||||
array_push($arrEtapes, htmlspecialchars(pg_escape_string($_POST['villeDepart'])));
|
||||
while (isset($_POST['etape'.$i])){
|
||||
array_push($arrEtapes, htmlspecialchars(pg_escape_string($_POST['etape'.$i])));
|
||||
$i++;
|
||||
}
|
||||
//Vérifie le nombre d'étapes entré par l'utilisateur
|
||||
if (count($arrEtapes) == 0 || intval($nbEtapes)<1 || intval($nbEtapes) != count($arrEtapes)){
|
||||
header('Location: depotTrajet.php?error=1');
|
||||
exit();
|
||||
}
|
||||
//Vérifie que les dates entrées par l'utilisateur ne se chevauchent pas et sont correctes
|
||||
if (!checkDates($db, $mail, $dateDepart, $dateArrivee)){
|
||||
header('Location: depotTrajet.php?error=2');
|
||||
exit();
|
||||
}
|
||||
//Vérifie la voiture de l'utilisateur est correcte
|
||||
if (!checkVoiture($db, $mail, $voiture)){
|
||||
header('Location: depotTrajet.php?error=3');
|
||||
exit();
|
||||
}
|
||||
//Creer le trajet en bd
|
||||
$result = creerTrajet($db, $mail, $dateDepart, $dateArrivee, $voiture);
|
||||
if ($result){
|
||||
$codeTrajet = pg_fetch_array($result)[0];
|
||||
//Creer les etapes en bd
|
||||
$result = creerEtapes($db, $codeTrajet, $arrEtapes);
|
||||
header('Location: ../tableauBord/tableauBord.php');
|
||||
exit();
|
||||
}
|
||||
if (!$result){
|
||||
header('Location: depotTrajet.php?error=4');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="../ressources/libs/jquery-ui.min.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="stylesheet" href="depotTrajet.css">
|
||||
<title>Déposer un trajet</title>
|
||||
</head>
|
||||
<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 type="application/javascript" src="../ressources/libs/chosen.jquery.min.js"></script>
|
||||
<?php require_once ("../ressources/navbarhtml.php"); ?>
|
||||
<div id="formulaire">
|
||||
<h1>Déposer un trajet</h1>
|
||||
<form method="post" enctype="multipart/form-data" action="depotTrajet.php">
|
||||
<div class="line">
|
||||
<label class="label" for="dateDepart">Date départ : </label>
|
||||
<input type="datetime-local" class="form" name="dateDepart" id="dateDepart" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label class="label" for="dateArrivee">Date arrivée : </label>
|
||||
<input type="datetime-local" class="form" name="dateArrivee" id="dateArrivee" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label class="label" for="voiture">Voiture : </label>
|
||||
<select class="form" name="voiture" id="voiture" required>
|
||||
<option selected></option>
|
||||
<?php afficherVoitures($db, $mail); ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label class="label" for="villeDepart">Ville de départ : </label>
|
||||
<input type="text" class="form, villeText" name="villeDepartText" id="villeDepartText">
|
||||
<select class="form, villeSelect" name="villeDepart" id="villeDepart" required>
|
||||
<option selected></option>
|
||||
<?php afficherVilles($db); ?>
|
||||
</select>
|
||||
</div>
|
||||
<div id="villeEtapeDiv" class="line">
|
||||
<label class="label" for="villeEtape">Etape : </label>
|
||||
<input type="text" class="form, villeText" id="villeEtapeText" name="villeEtapeText">
|
||||
<select class="form, villeSelect" name="villeEtape" id="villeEtape" required>
|
||||
<option selected></option>
|
||||
<?php afficherVilles($db); ?>
|
||||
</select>
|
||||
</div>
|
||||
<div id="boutonEtape" class="line">
|
||||
<input class="button" id="ajoutEtape" type="button" value="Ajouter une étape">
|
||||
<input id="supprimerEtape" class='button' type='button' value='Supprimer une étape'>
|
||||
<input id="nbEtapes" name="nbEtapes" type="hidden" value="1" required>
|
||||
</div>
|
||||
<?php
|
||||
if (isset($_GET['error'])){
|
||||
echo "<p class='error'>".getErrorDepotTrajet($_GET['error'])."</p>";
|
||||
}
|
||||
?>
|
||||
<div class="line">
|
||||
<input id="submit" class="button" type="submit" value="Poster le trajet">
|
||||
</div>
|
||||
</form>
|
||||
<script src="depotTrajet.js"></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 42 KiB |
@ -1,40 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang = "fr">
|
||||
<head>
|
||||
<meta charset = "UTF-8">
|
||||
<link rel = "stylesheet" href = "deposer_avis.css">
|
||||
<title>Deposer un avis</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id = "container">
|
||||
|
||||
<div id ="entete">
|
||||
<h1 id = "titre">Deposer un avis</h1>
|
||||
</div>
|
||||
|
||||
<div id = "form">
|
||||
<form id="formulaire_avis" action="deposer_avis.php" method="post">
|
||||
|
||||
<div>
|
||||
<textarea id="avis_laisse" name="avis_laisse" form="formulaire_avis" rows="10" cols="100" placeholder="Avis"></textarea>
|
||||
</div>
|
||||
<h2>NOTE</h2>
|
||||
<div class="rating"><!--
|
||||
--><a href="#1" title="Donner 1 étoile">☆</a><!--
|
||||
--><a href="#2" title="Donner 2 étoiles">☆</a><!--
|
||||
--><a href="#3" title="Donner 3 étoiles">☆</a><!--
|
||||
--><a href="#4" title="Donner 4 étoiles">☆</a><!--
|
||||
--><a href="#5" title="Donner 5 étoiles">☆</a>
|
||||
</div>
|
||||
</br>
|
||||
<div>
|
||||
<input type="submit" value="Valider" id="submit">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
//Declaration des fonctions
|
||||
|
||||
function checkAvis($db, $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);
|
||||
return $row[0] == 0;
|
||||
}
|
||||
|
||||
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));
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0] >= 1;
|
||||
}
|
||||
|
||||
//Importation des fichiers necessaires
|
||||
|
||||
session_start();
|
||||
require_once("../connexionBD.php");
|
||||
require_once("../ressources/user.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['codetrajet']) && isset($_POST['avislaisse']) && isset($_POST['note'])) {
|
||||
//Recuperation des variables passer par le formulaire
|
||||
$avis = $_POST['avislaisse'];
|
||||
$note = $_POST['note'];
|
||||
$codetrajet = intval($_POST['codetrajet']);
|
||||
$date = date('Y-m-d H:i:s');
|
||||
if (checkAvis($db, $mail, $codetrajet) && checkCodeTrajetAvis($db, $mail, $codetrajet)) {
|
||||
$requete = "INSERT INTO avis (mailemetteur, codetrajet, commentaire, dateavis, note, estlu) VALUES ($1,$2,$3,$4,$5, false);"; //Requete d'insertion
|
||||
$envoi = pg_query_params($db, $requete, array($mail, $codetrajet, $avis, $date, $note)); // Envoie de la requete
|
||||
if (!$envoi) { //Erreur
|
||||
echo "Erreur d'ecriture dans la BD";
|
||||
echo "<br><a href='../tableauBord/tableauBord.php'>Retour vers le tableau de bord</a>";
|
||||
exit();
|
||||
} else { //Redirection en cas de reussite
|
||||
header('Location: ../tableauBord/tableauBord.php');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="deposer_avis.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Deposer un avis</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php require_once("../ressources/navbarhtml.php"); ?>
|
||||
<div id="container">
|
||||
<div id="entete"> <--Entete-->
|
||||
<h1 id="titre">Deposer un avis</h1>
|
||||
</div>
|
||||
<div id="form"><--Formulaire-->
|
||||
<form id="formulaire_avis" enctype="multipart/form-data" action="deposer_avis.php" method="post">
|
||||
<textarea id="avis_laisse" name="avislaisse" form="formulaire_avis" placeholder="Avis"></textarea> <--Champ_de_saisie_d_avis-->
|
||||
<h2>NOTE</h2>
|
||||
<div class="rating"><--Bouton_note-->
|
||||
<input type="radio" name="note" id="note3" value="3">
|
||||
<a href="#3" label for="note3" title="Donner 3 étoiles">☆</a>
|
||||
<input type="radio" name="note" id="note2" value="2">
|
||||
<a href="#2" label for="note2" title="Donner 2 étoiles">☆</a>
|
||||
<input type="radio" name="note" id="note1" value="1">
|
||||
<a href="#1" label for="note1" title="Donner 1 étoiles">☆</a>
|
||||
<?php
|
||||
if (isset($_GET['codetrajet'])) {
|
||||
$codeTrajet = $_GET['codetrajet'];
|
||||
echo "<input type='hidden' name='codetrajet' value='$codeTrajet'>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<br>
|
||||
<input type="submit" value="Valider" id="submit"><--Envoie-->
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 4.0 KiB |
@ -0,0 +1,109 @@
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Arial";
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
html, body{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#formulaire{
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
padding: 4em;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
#enregistrer{
|
||||
margin-top: 1em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
form{
|
||||
margin-top: 3em;
|
||||
}
|
||||
|
||||
.form{
|
||||
box-sizing: border-box;
|
||||
width: 55%;
|
||||
border: 1px solid grey;
|
||||
margin-bottom: 0.7em;
|
||||
}
|
||||
|
||||
#avatar{
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
.button{
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
padding: 8px;
|
||||
color: white;
|
||||
background-color: rgb(65, 154, 28);
|
||||
border-radius: 5em;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.button:hover{
|
||||
background-color: rgb(48, 112, 20);
|
||||
border-color: rgb(48, 112, 20);
|
||||
}
|
||||
|
||||
.button:disabled{
|
||||
cursor: not-allowed;
|
||||
background-color: grey;
|
||||
}
|
||||
|
||||
#submit{
|
||||
margin-top: 1em;
|
||||
margin-left: 50%;
|
||||
transform: translate(-50%);
|
||||
}
|
||||
|
||||
.line{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
justify-content: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#error{
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.error{
|
||||
color: red;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
label{
|
||||
box-sizing: border-box;
|
||||
font-size: 1.1em;
|
||||
width: 45%;
|
||||
min-width: 8em;
|
||||
}
|
||||
|
||||
h1{
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
button{
|
||||
color: forestgreen;
|
||||
border-color: forestgreen;
|
||||
border-radius: 5em;
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once('../connexionBD.php');
|
||||
require_once('../ressources/user.php');
|
||||
|
||||
if (!isset($_SESSION['mail'])){
|
||||
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'])){
|
||||
$login = htmlentities(pg_escape_string($_POST['login']));
|
||||
$password = htmlentities(pg_escape_string($_POST['password']));
|
||||
$prenom = htmlentities(pg_escape_string($_POST['prenom']));
|
||||
$nom = htmlentities(pg_escape_string($_POST['nom']));
|
||||
$dateN = htmlentities(pg_escape_string($_POST['dateN']));
|
||||
$mail = strtolower(htmlentities(pg_escape_string($_POST['mail'])));
|
||||
$phone = htmlentities(pg_escape_string($_POST['phone']));
|
||||
|
||||
if (!filter_var($mail, FILTER_VALIDATE_EMAIL)){
|
||||
header('Location: inscription.php?error=1');
|
||||
exit();
|
||||
}
|
||||
elseif (!isMailUnique($db, $mail)){
|
||||
header('Location: inscription.php?error=2');
|
||||
exit();
|
||||
}
|
||||
elseif (!isLoginUnique($db, $login)){
|
||||
header('Location: inscription.php?error=3');
|
||||
exit();
|
||||
}
|
||||
else {
|
||||
if (isset($_FILES['avatar']) and !empty($_FILES['avatar']['name'])) {
|
||||
$fic = $_FILES['avatar'];
|
||||
$res = uploadAvatar($mail, $fic);
|
||||
switch ($res){
|
||||
case -1:
|
||||
header('Location: inscription.php?error=4');
|
||||
exit();
|
||||
case -2:
|
||||
header('Location: inscription.php?error=5');
|
||||
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();
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="inscription.css">
|
||||
<title>Inscription</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="formulaire">
|
||||
<h1>Inscription</h1>
|
||||
<form method="post" enctype="multipart/form-data" action="inscription.php">
|
||||
<div class="line">
|
||||
<label for="mail">Adresse mail : </label>
|
||||
<input id="mail" class="form" name="mail" type="email" maxlength="100" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="login">Login : </label>
|
||||
<input id="login" class="form" name="login" type="text" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="password">Mot de passe : </label>
|
||||
<input class="form" id="password" name="password" type="password" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="confirmation">Confirmation : </label>
|
||||
<input class="form" id="confirmation" name="confirmation" type="password" maxlength="16">
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="prenom">Prénom : </label>
|
||||
<input id="prenom" class="form" name="prenom" type="text" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="nom">Nom : </label>
|
||||
<input id="nom" class="form" name="nom" type="text" maxlength="50" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="dateN">Date de naissance : </label>
|
||||
<input id="dateN" class="form" name="dateN" type="date" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="phone">Numéro de téléphone : </label>
|
||||
<input id="phone" class="form" name="phone" type="tel" pattern="[0-9]{10}" maxlength="10" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="avatar">Image du Profil :</label>
|
||||
<input type="file" id="avatar" class="form" name="avatar" accept="image/png, image/jpeg">
|
||||
</div>
|
||||
<?php getErrorInscription($_GET['error']); ?>
|
||||
<input id="submit" class="button" type="submit" value="S'inscrire">
|
||||
</form>
|
||||
<p id="enregistrer">Si vous avez déjà un compte <a href="index.php" title="S'identifier">cliquez ici</a>.</p>
|
||||
</div>
|
||||
<script src="inscription.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
require_once ("../connexionBD.php");
|
||||
require_once ("../ressources/trajet.php");
|
||||
session_start();
|
||||
|
||||
//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($_GET['codetrajet'])){
|
||||
$codetrajet = $_GET['codetrajet'];
|
||||
annulerTrajet($db, $codetrajet);
|
||||
}
|
||||
header('Location: ../tableauBord/tableauBord.php');
|
||||
exit();
|
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once("../connexionBD.php");
|
||||
require_once("../ressources/trajet.php");
|
||||
require_once("../ressources/user.php");
|
||||
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
$mail = $_SESSION['mail'];
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="liste_trajet_publie.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Liste des trajets publiés</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 publiés</h1>
|
||||
<br>
|
||||
<h2>Trajets publiés : </h2>
|
||||
</div>
|
||||
<div id="liste">
|
||||
<table>
|
||||
<?php
|
||||
$result = pg_query_params($db, "SELECT * FROM Trajet Where mailproposition = $1 AND estannule = false;", array($mail));
|
||||
while ($row = pg_fetch_array($result)) {
|
||||
$login = getLogin($db, $mail);
|
||||
$date_depart = $row['datedepart'];
|
||||
$codetrajet = $row['codetrajet'];
|
||||
$source = getDepart($db, $codetrajet);
|
||||
$dest = getFin($db, $codetrajet);
|
||||
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='annulerTrajet.php?codetrajet=$codetrajet'>Annuler le trajet</a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
require_once ("../connexionBD.php");
|
||||
require_once ("../ressources/trajet.php");
|
||||
session_start();
|
||||
|
||||
//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($_GET['codetrajet'])){
|
||||
$codetrajet = $_GET['codetrajet'];
|
||||
annulerReservation($db, $mail, $codetrajet);
|
||||
}
|
||||
header('Location: ../tableauBord/tableauBord.php');
|
||||
exit();
|
@ -0,0 +1,55 @@
|
||||
<?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'];
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="liste_trajet_reserve.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<link rel="icon" href="../ressources/favicon.ico"/>
|
||||
<title>Liste des trajets réservés</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 réservés</h1>
|
||||
<br>
|
||||
</div>
|
||||
<div id="liste">
|
||||
<table>
|
||||
<?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));
|
||||
while ($row = pg_fetch_array($result)) {
|
||||
$login = $row['login'];
|
||||
$date_depart = $row['datedepart'];
|
||||
$codetrajet = $row['codetrajet'];
|
||||
$source = getDepart($db, $codetrajet);
|
||||
$dest = getFin($db, $codetrajet);
|
||||
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><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>";
|
||||
echo "</tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 42 KiB |
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
$source = "Toulouse";
|
||||
$dest = "Albi";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang = "fr">
|
||||
<head>
|
||||
<meta charset = "UTF-8">
|
||||
<link rel = "stylesheet" href = "liste.css">
|
||||
<title>Liste des trajets</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id = "container">
|
||||
|
||||
<div id ="entete">
|
||||
<a href = "LIEN TABLEAU DE BORD"><img id = "bouton_retour" src = "return.png" alt = "Bouton retour"></a>
|
||||
<h1 class = "float" id = "titre">Liste des trajets</h1>
|
||||
<br>
|
||||
<h2>Trajets recherchés : <?php echo $source ?> --> <?php echo $dest ?> </h2>
|
||||
</div>
|
||||
|
||||
<div id = "liste">
|
||||
<hr class="separation" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,53 @@
|
||||
/*General*/
|
||||
|
||||
body {
|
||||
color:black;
|
||||
background-color:white;
|
||||
background-image:url("../ressources/image/background.jpg");
|
||||
background-repeat:no-repeat;
|
||||
background-size:104%;
|
||||
margin: 0;
|
||||
font-family: Ubuntu,Helvetica,sans-serif;
|
||||
}
|
||||
|
||||
#container{
|
||||
margin : 5% 5% 5% 5%;
|
||||
background-color : white;
|
||||
border : 2px solid black;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align : center;
|
||||
font-size : 250%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h2{
|
||||
text-align : center;
|
||||
font-size : 150%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*Affichage liste trajets*/
|
||||
|
||||
#bouton_retour{
|
||||
transform : rotate(45deg);
|
||||
}
|
||||
|
||||
.separation{
|
||||
margin-top : 5%;
|
||||
margin-left : 20%;
|
||||
min-height: 2em;
|
||||
width : 5px;
|
||||
background: black;
|
||||
}
|
||||
|
||||
td{
|
||||
padding-left: 1.5em;
|
||||
padding-right: 1.5em;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
#info{
|
||||
width: 60%;
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
<?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>
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
//Declaration de fonction
|
||||
|
||||
function verifierTrajet($db, $mail, $codetrajet){
|
||||
$trajet = getTrajet($db, $codetrajet);
|
||||
if (!$trajet){
|
||||
return false;
|
||||
}
|
||||
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'])) { // 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)){ // Test si place dispo et si on peut reserver
|
||||
reserver($db, $mail, $codetrajet);
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: ../tableauBord/tableauBord.php');
|
||||
exit();
|
||||
|
||||
|
||||
|
||||
?>
|
Before Width: | Height: | Size: 4.0 KiB |
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once('../connexionBD.php');
|
||||
require_once ('../ressources/verifconnecte.php');
|
||||
require_once ('../ressources/user.php');
|
||||
|
||||
$user = getUser($db, $mail);
|
||||
if(!$user['estadmin']){
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
$delmail = isset($_POST['delmail']) ? $_POST['delmail'] : NULL;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="profil.css">
|
||||
<link rel="stylesheet" href="../ressources/navbaradminhtml.css">
|
||||
<script src="../inscription/inscription.js"></script>
|
||||
<title>Administration</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php require_once("../ressources/navbaradminhtml.php"); ?>
|
||||
<div id="formulaire">
|
||||
<h1>Administration</h1>
|
||||
<div>
|
||||
<h1>Supprimer un utilisateur</h1>
|
||||
<fieldset>
|
||||
<form action="admin.php" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<td><p>mail de l'utilisateur a supprimer :</p></td>
|
||||
<td><input type="text" name="delmail"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><input type="submit" name="deluserbutton" value="supprimer l'utilisateur"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php if (isset($_POST['delmail'])) { if (deluser($db, $delmail)){ echo "Utilisateur supprimé"; }}?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,143 @@
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Arial", sans-serif;
|
||||
}
|
||||
|
||||
#divImgProfil{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#mail, #dateN{
|
||||
background-color: lightgray;
|
||||
}
|
||||
|
||||
#imgProfil{
|
||||
background-color: white;
|
||||
margin-top: 2.5em;
|
||||
width: 60%;
|
||||
height: 60%;
|
||||
max-width: 210px;
|
||||
max-height: 210px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#changePass{
|
||||
margin-bottom: 0.7em;
|
||||
}
|
||||
|
||||
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Arial";
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
html, body{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
background-image: url("../ressources/image/background.jpg");
|
||||
background-size : cover;
|
||||
background-position: center, center;
|
||||
}
|
||||
|
||||
#formulaire{
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
padding: 4em;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
#enregistrer{
|
||||
margin-top: 1em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
form{
|
||||
margin-top: 3em;
|
||||
}
|
||||
|
||||
.form{
|
||||
box-sizing: border-box;
|
||||
width: 55%;
|
||||
border: 1px solid grey;
|
||||
margin-bottom: 0.7em;
|
||||
}
|
||||
|
||||
#avatar{
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
.button{
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
padding: 8px;
|
||||
color: white;
|
||||
background-color: rgb(65, 154, 28);
|
||||
border-radius: 5em;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.button:hover{
|
||||
background-color: rgb(48, 112, 20);
|
||||
border-color: rgb(48, 112, 20);
|
||||
}
|
||||
|
||||
.button:disabled{
|
||||
cursor: not-allowed;
|
||||
background-color: grey;
|
||||
}
|
||||
|
||||
#submit{
|
||||
margin-top: 1em;
|
||||
margin-left: 50%;
|
||||
transform: translate(-50%);
|
||||
}
|
||||
|
||||
.line{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
justify-content: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#error{
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.error{
|
||||
color: red;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
label{
|
||||
box-sizing: border-box;
|
||||
font-size: 1.1em;
|
||||
width: 45%;
|
||||
min-width: 8em;
|
||||
}
|
||||
|
||||
h1{
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
button{
|
||||
color: forestgreen;
|
||||
border-color: forestgreen;
|
||||
border-radius: 5em;
|
||||
}
|
@ -0,0 +1,268 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once('../connexionBD.php');
|
||||
require_once ('../ressources/user.php');
|
||||
require_once ('../ressources/verifconnecte.php');
|
||||
require_once ('../ressources/voiture.php');
|
||||
|
||||
$matricule = isset($_POST['matricule']) ? $_POST['matricule'] : NULL; //recuperation valeur formulaire, isset pour eviter l'erreur "Notice: Undefined index"
|
||||
$marque = isset($_POST['marque']) ? $_POST['marque'] : NULL;
|
||||
$modele = isset($_POST['modele']) ? $_POST['modele'] : NULL;
|
||||
$nbplaces = isset($_POST['nbplaces']) ? $_POST['nbplaces'] : NULL;
|
||||
$anneefab = isset($_POST['anneefab']) ? $_POST['anneefab'] : NULL;
|
||||
|
||||
if (isset($_POST['submitadd'])) { //si formulaire pressé appele la methode
|
||||
$result = pg_query_params($db, "SELECT COUNT(*), matricule FROM voiture WHERE mail = $1 GROUP BY matricule;", array($mail));
|
||||
$row = pg_fetch_array($result);
|
||||
if($row[0] == 0){
|
||||
addVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab);
|
||||
}
|
||||
}
|
||||
if (isset($_POST['submitchange'])) {
|
||||
changeVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab);
|
||||
}
|
||||
|
||||
$user = getUser($db, $mail);
|
||||
|
||||
if (!$user){
|
||||
header('Location: profil.php?error=3');
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_POST['login']) || isset($_FILES['avatar'])){ //si connecte ou si avatar de defini
|
||||
if (isset($_FILES['avatar']) and !empty($_FILES['avatar']['name'])) { //si avatar et pas de fichier au nom de l'utilisateur
|
||||
$fic = $_FILES['avatar']; //avatar envoyé par l'utilisateur
|
||||
supprimerAvatar($mail); //supprime l'avatar courant de l'utilisateur
|
||||
$res = uploadAvatar($mail, $fic); //enregistre l'avatar avec le mail de l'utilisateur
|
||||
switch ($res){ //controle d'erreur de la fonction uploadAvatar
|
||||
case -1:
|
||||
header('Location: profil.php?error=4');
|
||||
exit();
|
||||
case -2:
|
||||
header('Location: profil.php?error=5');
|
||||
exit();
|
||||
case -3:
|
||||
header('Location: profil.php?error=6');
|
||||
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
|
||||
$login = htmlentities(pg_escape_string($_POST['login'])); //recupere la variable du formulaire
|
||||
$password = htmlentities(pg_escape_string($_POST['password']));
|
||||
$confirmation = htmlentities(pg_escape_string($_POST['confirmation']));
|
||||
$prenom = htmlentities(pg_escape_string($_POST['prenom']));
|
||||
$nom = htmlentities(pg_escape_string($_POST['nom']));
|
||||
$phone = htmlentities(pg_escape_string($_POST['phone']));
|
||||
|
||||
if (loginChange($user, $login)) {
|
||||
if (!isLoginUniqueModifier($db, $mail, $login)) {
|
||||
header('Location: profil.php?error=1');
|
||||
exit();
|
||||
} else {
|
||||
if (!modifierLogin($db, $mail, $login)) {
|
||||
header('Location: profil.php?error=6');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp($password, $confirmation) != 0) {
|
||||
header('Location: profil.php?error=2');
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!modifierUtilisateur($db, $mail, $prenom, $nom, $password, $phone)) {
|
||||
header('Location: profil.php?error=6');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
sleep(0.85);
|
||||
header('Location: profil.php');
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="profil.css">
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css">
|
||||
<script src="../inscription/inscription.js"></script>
|
||||
<title>Profil</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php require_once("../ressources/navbarhtml.php"); ?>
|
||||
<div id="formulaire">
|
||||
<h1>Profil de <?php echo $user['prenom']; ?></h1>
|
||||
<div id="divImgProfil">
|
||||
<img id="imgProfil" src="<?php echo getPathImgProfil($mail); ?>">
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function visibilite(thingId){
|
||||
var targetElement;
|
||||
var elements;
|
||||
targetElement = document.getElementById(thingId) ;
|
||||
elements = document.getElementsByClassName("Element")
|
||||
for (var i = 0; i < elements.length; i++){
|
||||
if(!targetElement.isSameNode(elements[i])){
|
||||
elements[i].style.display = "none" ;
|
||||
}
|
||||
}
|
||||
if (targetElement.style.display == "none"){
|
||||
targetElement.style.display = "";
|
||||
}
|
||||
else{
|
||||
targetElement.style.display = "none" ;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<ul class="profil-nav">
|
||||
<li class="FT"><a href="" onclick="javascript:visibilite('profilgeneral'); return false;">Profil général</a></li>
|
||||
<li class="FT"><a href="" onclick="javascript:visibilite('profilvoiture'); return false;">Profil voiture</a></li>
|
||||
</ul>
|
||||
<div id="profilgeneral" class="Element" style="display:none;">
|
||||
<form method="post" action="profil.php" enctype="multipart/form-data">
|
||||
<div class="line">
|
||||
<label for="mail">Adresse mail : </label>
|
||||
<input id="mail" class="form" type="email" maxlength="100" readonly value="<?php echo $user['mail']; ?>">
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="login">Login : </label>
|
||||
<input id="login" class="form" name="login" type="text" maxlength="50"
|
||||
value="<?php echo $user['login']; ?>" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="password">Mot de passe : </label>
|
||||
<input class="form" id="password" name="password" type="password" maxlength="50"
|
||||
value="<?php echo $user['passwd']; ?>" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="confirmation">Confirmation : </label>
|
||||
<input class="form" id="confirmation" name="confirmation" type="password" maxlength="16"
|
||||
value="<?php echo $user['passwd']; ?>" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="prenom">Prénom : </label>
|
||||
<input id="prenom" class="form" name="prenom" type="text" maxlength="50"
|
||||
value="<?php echo $user['prenom']; ?>" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="nom">Nom : </label>
|
||||
<input id="nom" class="form" name="nom" type="text" maxlength="50" value="<?php echo $user['nom']; ?>"
|
||||
required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="dateN">Date de naissance : </label>
|
||||
<input id="dateN" class="form" readonly="readonly" type="date"
|
||||
value="<?php echo $user['datenaissance']; ?>" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="phone">Numéro de téléphone : </label>
|
||||
<input id="phone" class="form" name="phone" type="tel" pattern="[0-9]{10}" maxlength="10"
|
||||
value="<?php echo $user['telephone']; ?>" required>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label for="avatar">Image du Profil :</label>
|
||||
<input type="file" id="avatar" class="form" name="avatar" accept="image/png, image/jpeg">
|
||||
</div>
|
||||
<?php getErrorProfil($_GET['error']); ?>
|
||||
<input id="submit" class="button" type="submit" value="Modifier">
|
||||
</form>
|
||||
</div>
|
||||
<div id="profilvoiture" class="Element" style="display:none;">
|
||||
<script type="text/javascript">
|
||||
function ShowTab(E) {
|
||||
document.getElementById("addVoiture").style.display = (E == 1) ? 'block' : 'none';
|
||||
document.getElementById("changeVoiture").style.display = (E == 2) ? 'block' : 'none';
|
||||
document.getElementById("showVoiture").style.display = (E == 3) ? 'block' : 'none';
|
||||
}
|
||||
</script>
|
||||
<form id="choixFormeTestVoiture">
|
||||
<div>
|
||||
<input type="radio" name="TabCheck" onclick="ShowTab(1)"/>Ajouter une voiture
|
||||
<input type="radio" name="TabCheck" onclick="ShowTab(2)"/>Modifier ma voiture
|
||||
<input type="radio" name="TabCheck" onclick="ShowTab(3)"/>Afficher ma voiture
|
||||
</div>
|
||||
</form>
|
||||
<div id="addVoiture" style="display: none;">
|
||||
<h1>Ajouter une voiture</h1>
|
||||
<fieldset>
|
||||
<form action="profil.php" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<td><p>matricule :</p></td>
|
||||
<td><input type="text" name="matricule"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p>marque :</p></td>
|
||||
<td><input type="text" name="marque"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p>modele :</p></td>
|
||||
<td><input type="text" name="modele"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p>nombre de places :</p></td>
|
||||
<td><input type="number" maxlength="1" name="nbplaces"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p>année de fabrication :</p></td>
|
||||
<td><input type="number" nmaxlength="4" name="anneefab"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><input type="submit" name="submitadd" value="ajouter une voiture"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div id="changeVoiture" style="display: none;">
|
||||
<h1>Modifier une voiture</h1>
|
||||
<fieldset>
|
||||
<form action="profil.php" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<td><p>matricule :</p></td>
|
||||
<td><input type="text" name="matricule"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p>marque :</p></td>
|
||||
<td><input type="text" name="marque"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p>modele :</p></td>
|
||||
<td><input type="text" name="modele"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p>nombre de places :</p></td>
|
||||
<td><input type="number" maxlength="1" name="nbplaces"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p>année de fabrication :</p></td>
|
||||
<td><input type="number" nmaxlength="4" name="anneefab"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><input type="submit" name="submitchange" value="modifier une voiture"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div id="showVoiture" style="display: none;">
|
||||
<h1>Afficher ma voiture</h1>
|
||||
<fieldset>
|
||||
<form action="profil.php" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<td><p><input type="submit" name="submitshow" value="afficher ma voiture"></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php if (isset($_POST['submitshow'])) { showVoiture($db); }?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,40 @@
|
||||
.centrage {
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
#container {
|
||||
margin: 5% 15% 2% 15%;
|
||||
background-color: white;
|
||||
border: 2px solid black;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 250%;
|
||||
}
|
||||
|
||||
#form {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once('../ressources/verifconnecte.php');
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" href="recherche.css"/>
|
||||
<link rel="stylesheet" href="../ressources/navbarhtml.css"/>
|
||||
<title>Rechercher trajet</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require_once("../ressources/navbarhtml.php");
|
||||
?>
|
||||
<div id="container">
|
||||
<div id="entete">
|
||||
<h1>Rechercher trajet</h1><br/>
|
||||
</div>
|
||||
<div class="global bord">
|
||||
<form method="post" action="../liste_trajets/liste_trajet.php">
|
||||
|
||||
<label>
|
||||
<input name="lieu_depart" type="text" placeholder="Lieu de départ" class="centrage" required>
|
||||
<br/>
|
||||
<br/>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input name="lieu_arrivee" type="text" placeholder="Lieu d'arrivée" class="centrage" required>
|
||||
<br/>
|
||||
<br/>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input name="date_heure" type="date" placeholder="Date et heure de départ" class="centrage"
|
||||
required>
|
||||
<br/>
|
||||
</label>
|
||||
<br/>
|
||||
<label>
|
||||
<input id="submit" name="submit" type="submit" value="Rechercher" class="centrage">
|
||||
</label>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
After Width: | Height: | Size: 1.9 MiB |
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 5.0 KiB |
@ -0,0 +1,59 @@
|
||||
#menuDiv {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#menuDiv a {
|
||||
font-family: Ubuntu, Helvetica, sans-serif;
|
||||
font-size: 1em;
|
||||
height: 20%;
|
||||
}
|
||||
|
||||
#menu {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: rgb(35, 35, 35);
|
||||
}
|
||||
|
||||
#logo {
|
||||
width: 50%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#divFlex{
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
width: 10%;
|
||||
min-width: 5em;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.menuItem {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
width: 10%;
|
||||
min-width: 5em;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
padding: 0.8em;
|
||||
border-bottom: 4px solid rgb(35, 35, 35);
|
||||
border-top: 4px solid rgb(35, 35, 35);
|
||||
font-size: 1.1em;
|
||||
text-align: center;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.menuItem:hover {
|
||||
border-bottom: 4px solid rgb(65, 154, 28);
|
||||
}
|
||||
|
||||
#colorAdmin{
|
||||
background-color: red;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<div id="menuDiv">
|
||||
<nav id="menu">
|
||||
<div id="divFlex"><div id="divlogo"><img src="../ressources/logo.png" alt="logo Upssi'Covoit" id="logo"/></div></div>
|
||||
<a class="menuItem" href="../tableauBord/tableauBord.php">Tableau de bord</a>
|
||||
<a class="menuItem" href="../listeTrajetPublie/liste_trajet_publie.php">Trajets publiés</a>
|
||||
<a class="menuItem" href="../listeTrajetReserve/liste_trajet_reserve.php">Trajets réservés</a>
|
||||
<a class="menuItem" href="../avis_recus/avis_recus.php">Avis reçus</a>
|
||||
<a class="menuItem" href="../avis_laisses/avis_laisses.php">Avis laissés</a>
|
||||
<a id="colorAdmin" class="menuItem" href="../profil/admin.php">Administration</a>
|
||||
<a class="menuItem" href="../deconnexion.php">Se déconnecter</a>
|
||||
</nav>
|
||||
</div>
|
@ -0,0 +1,55 @@
|
||||
#menuDiv {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#menuDiv a {
|
||||
font-family: Ubuntu, Helvetica, sans-serif;
|
||||
font-size: 1em;
|
||||
height: 20%;
|
||||
}
|
||||
|
||||
#menu {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: rgb(35, 35, 35);
|
||||
}
|
||||
|
||||
#logo {
|
||||
width: 50%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#divFlex{
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
width: 10%;
|
||||
min-width: 5em;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.menuItem {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
width: 10%;
|
||||
min-width: 5em;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
padding: 0.8em;
|
||||
border-bottom: 4px solid rgb(35, 35, 35);
|
||||
border-top: 4px solid rgb(35, 35, 35);
|
||||
font-size: 1.1em;
|
||||
text-align: center;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.menuItem:hover {
|
||||
border-bottom: 4px solid rgb(65, 154, 28);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
require_once ('../connexionBD.php');
|
||||
require_once ('../ressources/user.php');
|
||||
require_once ('verifconnecte.php');
|
||||
if (!strcmp(getUser($db, $mail)['estadmin'], 't')) {
|
||||
require_once ('../ressources/navbaradminhtml.php');
|
||||
}
|
||||
else {
|
||||
echo"
|
||||
<div id='menuDiv'>
|
||||
<nav id='menu'>
|
||||
<div id='divFlex'><div id='divlogo'><img src='../ressources/logo.png' alt='logo Upssi'Covoit' id='logo'/></div></div>
|
||||
<a class='menuItem' href='../tableauBord/tableauBord.php''>Tableau de bord</a>
|
||||
<a class='menuItem' href='../listeTrajetPublie/liste_trajet_publie.php'>Trajets publiés</a>
|
||||
<a class='menuItem' href='../listeTrajetReserve/liste_trajet_reserve.php'>Trajets réservés</a>
|
||||
<a class='menuItem' href='../avis_recus/avis_recus.php'>Avis reçus</a>
|
||||
<a class='menuItem' href='../avis_laisses/avis_laisses.php'>Avis laissés</a>
|
||||
<a class='menuItem' href='../profil/profil.php'>Profil</a>
|
||||
<a class='menuItem' href='../deconnexion.php'>Se déconnecter</a>
|
||||
</nav>
|
||||
</div>";
|
||||
}
|
||||
?>
|
@ -0,0 +1,197 @@
|
||||
<?php
|
||||
//Récupérer la liste complete des villes
|
||||
function getListeVilles($db)
|
||||
{
|
||||
$result = pg_query($db, "SELECT * FROM Ville;");
|
||||
return $result;
|
||||
}
|
||||
|
||||
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')));
|
||||
}
|
||||
|
||||
function getTrajet($db, $codetrajet)
|
||||
{
|
||||
return pg_query_params($db, "SELECT * FROM Trajet WHERE codetrajet = $1;", array($codetrajet));
|
||||
}
|
||||
|
||||
//Créer un trajet en bd
|
||||
function creerTrajet($db, $mail, $dateDepart, $datArrivee, $matricule)
|
||||
{
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$result = pg_query_params($db, "INSERT INTO Trajet (datedepart, datearrivee, dateproposition, estannule, mailproposition, matricule) VALUES ($1, $2, $3, false, $4, $5) RETURNING codeTrajet;", array($dateDepart, $datArrivee, $date, $mail, $matricule));
|
||||
return $result;
|
||||
}
|
||||
|
||||
//Creer les étapes d'un trajet
|
||||
function creerEtapes($db, $codeTrajet, $etapes)
|
||||
{
|
||||
$result = true;
|
||||
for ($i = 0; $i < count($etapes) && $result; $i++) {
|
||||
$arr = explode("%%", $etapes[$i]);
|
||||
$result = pg_query_params($db, "INSERT INTO traverser (codetrajet, nomville, codepostal, numeroetape) VALUES ($1, $2, $3, $4);", array($codeTrajet, $arr[0], $arr[1], $i + 1));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
//Vérifier la cohérence des dates
|
||||
function checkDates($db, $mail, $dateDepart, $dateArrivee)
|
||||
{
|
||||
$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));
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0] == 0 && $valide;
|
||||
}
|
||||
|
||||
//Vérifier le nombre de places restantes
|
||||
function checkPlacesVoiture($db, $codetrajet)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT nbplaces FROM Voiture vo, Trajet ta WHERE vo.matricule = ta.matricule AND ta.codeTrajet = $1;", array($codetrajet));
|
||||
$result2 = pg_query_params($db, "SELECT COUNT(*) FROM Reserver re, Trajet ta WHERE re.codetrajet = ta.codetrajet AND ta.codetrajet = $1;", array($codetrajet));
|
||||
if(!$result || !$result2){
|
||||
return false;
|
||||
}
|
||||
$nbplaces = pg_fetch_array($result)[0];
|
||||
$nbreservations = pg_fetch_array($result)[0];
|
||||
return $nbplaces-1 > $nbreservations;
|
||||
}
|
||||
|
||||
//Vérifier la cohérence des dates
|
||||
function checkDatesReserve($db, $mail, $dateDepart)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT COUNT(*) From Trajet ta, reserver re WHERE re.mailutilisateur = $1 AND re.codetrajet = ta.codetrajet AND $2 BETWEEN datedepart AND datearrivee;", array($mail, $dateDepart));
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0] == 0;
|
||||
}
|
||||
|
||||
//Verifier reservations
|
||||
function checkReservations($db, $mail, $codetrajet)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT COUNT(*) From reserver WHERE mailutilisateur = $1 AND codetrajet = $2;", array($mail, $codetrajet));
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0] == 0;
|
||||
}
|
||||
|
||||
//Vérifier que l'utilisateur est bien associé à cette voiture
|
||||
function checkVoiture($db, $mail, $matricule)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT matricule From Voiture WHERE mail = $1 AND matricule = $2;", array($mail, $matricule));
|
||||
$row = pg_fetch_array($result);
|
||||
return !strcmp($matricule, $row[0]);
|
||||
}
|
||||
|
||||
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));
|
||||
if ($result) {
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
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));
|
||||
if ($result) {
|
||||
$row = pg_fetch_array($result);
|
||||
return $row[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getMessagesNonLus($db, $mail)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT COUNT(*) from Message WHERE mailRecepteur = $1 AND estLu = FALSE;", array($mail));
|
||||
if ($result) {
|
||||
$row = pg_fetch_array($result);
|
||||
$login = $row[0];
|
||||
return $login;
|
||||
}
|
||||
}
|
||||
|
||||
function getAvisNonLus($db, $mail)
|
||||
{
|
||||
global $db;
|
||||
$result = pg_query_params($db, "SELECT COUNT(tr.mailProposition) FROM Trajet tr, Avis av WHERE tr.codeTrajet = av.codeTrajet AND av.estLu = false AND tr.mailProposition = $1;", array($mail));
|
||||
if ($result) {
|
||||
$row = pg_fetch_array($result);
|
||||
$login = $row[0];
|
||||
return $login;
|
||||
}
|
||||
}
|
||||
|
||||
//Récupérer la liste des voitures concernant un utilisateur
|
||||
function getListeVoitures($db, $mail)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT * FROM Voiture WHERE mail = $1;", array($mail));
|
||||
return $result;
|
||||
}
|
||||
|
||||
//Afficher les voitures dans un select
|
||||
function afficherVoitures($db, $mail)
|
||||
{
|
||||
$voitures = getListeVoitures($db, $mail);
|
||||
while ($row = pg_fetch_array($voitures)) {
|
||||
$modele = $row['modele'];
|
||||
$matricule = $row['matricule'];
|
||||
echo "<option value='$matricule'>$modele</option>";
|
||||
}
|
||||
}
|
||||
|
||||
//Afficher les voitures dans un select
|
||||
function afficherVilles($db)
|
||||
{
|
||||
$villes = getListeVilles($db);
|
||||
while ($row = pg_fetch_array($villes)) {
|
||||
$nom = $row['nomville'];
|
||||
$cp = $row['codepostal'];
|
||||
echo "<option value='$nom%%$cp'>$nom ($cp)</option>";
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
$return = false;
|
||||
if ($result) {
|
||||
$return = pg_fetch_array($result)[0];
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
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));
|
||||
$return = false;
|
||||
if ($result) {
|
||||
$return = pg_fetch_array($result)[0];
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
function annulerTrajet($db, $codetrajet){
|
||||
$result = pg_query_params($db, "UPDATE Trajet SET estannule = true WHERE codetrajet = $1;", array($codetrajet));
|
||||
return $result;
|
||||
}
|
||||
|
||||
function annulerReservation($db, $mail,$codetrajet){
|
||||
$result = pg_query_params($db, "DELETE FROM reserver WHERE codetrajet = $1 AND mailutilisateur = $2;", array($codetrajet, $mail));
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getErrorDepotTrajet($code)
|
||||
{
|
||||
switch ($code) {
|
||||
case 1:
|
||||
return "Erreur lors de la vérification des étapes.";
|
||||
case 2:
|
||||
return "Erreur lors de la vérification des dates.";
|
||||
case 3:
|
||||
return "Ce compte n'est pas associé à la voiture sélectionnée.";
|
||||
case 4:
|
||||
return "Erreur lors de l'enregistrement du trajet.";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,204 @@
|
||||
<?php
|
||||
//geterror de l'index
|
||||
function getErrorIndex($code)
|
||||
{
|
||||
switch ($code) {
|
||||
case 1:
|
||||
return "Adresse mail ou mot de passe invalide.";
|
||||
}
|
||||
}
|
||||
|
||||
function getErrorProfil($code)
|
||||
{
|
||||
switch ($code) {
|
||||
case 1:
|
||||
return "Ce login est déjà associé à un compte.";
|
||||
case 2:
|
||||
return "Les mots de passe ne correspondent pas.";
|
||||
case 3:
|
||||
return "Erreur lors de la récupération des informations de profil.";
|
||||
case 4:
|
||||
return "Le fichier envoyé doit être une image au format PNG ou JPEG.";
|
||||
case 5:
|
||||
return "La taille de l'image ne doit pas dépasser 2 MB.";
|
||||
case 6:
|
||||
return "Erreur lors de la modification du compte.";
|
||||
}
|
||||
}
|
||||
|
||||
function getErrorInscription($code)
|
||||
{
|
||||
switch ($code) {
|
||||
case 1:
|
||||
return "L'adresse mail est invalide.";
|
||||
case 2:
|
||||
return "Cette adresse est déjà associée à un compte.";
|
||||
case 3:
|
||||
return "Ce login est déjà associé à un compte.";
|
||||
case 4:
|
||||
return "Le fichier envoyé doit être une image au format PNG.";
|
||||
case 5:
|
||||
return "La taille de l'image ne doit pas dépasser 2 MB.";
|
||||
case 6:
|
||||
return "Erreur lors de la création du compte.";
|
||||
}
|
||||
}
|
||||
|
||||
function authentification($db, $mail, $password)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE mail = $1;", array($mail));
|
||||
if ($result) {
|
||||
$row = pg_fetch_array($result);
|
||||
return (strcmp($row["passwd"], $password)) == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function loginChange($user, $login)
|
||||
{
|
||||
return strcmp($user['login'], $login);
|
||||
}
|
||||
|
||||
function isLoginUniqueModifier($db, $mail, $login)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT login FROM Utilisateur WHERE login = $1 AND mail != $2;", array($login, $mail));
|
||||
if ($result) {
|
||||
$row = pg_fetch_array($result);
|
||||
return (strcmp($row['login'], $login) != 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function modifierLogin($db, $mail, $login)
|
||||
{
|
||||
$result = pg_query_params($db, "UPDATE Utilisateur SET login = $1 WHERE mail = $2;", array($login, $mail));
|
||||
return $result;
|
||||
}
|
||||
|
||||
function modifierUtilisateur($db, $mail, $prenom, $nom, $password, $phone)
|
||||
{
|
||||
$result = pg_query_params($db, "UPDATE Utilisateur SET prenom = $1, nom = $2, telephone = $3 , passwd = $4 WHERE mail = $5;", array($prenom, $nom, $phone, $password, $mail));
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getUser($db, $mail)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE mail = $1;", array($mail));
|
||||
return pg_fetch_array($result);
|
||||
}
|
||||
|
||||
function getPrenom($db, $mail)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT prenom from Utilisateur WHERE mail = $1;", array($mail));
|
||||
if ($result) {
|
||||
$row = pg_fetch_array($result);
|
||||
$prenom = $row[0];
|
||||
return $prenom;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getLogin($db, $mail)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT login from Utilisateur WHERE mail = $1;", array($mail));
|
||||
if ($result) {
|
||||
$row = pg_fetch_array($result);
|
||||
$login = $row[0];
|
||||
return $login;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getPathImgProfilTableau($mail)
|
||||
{
|
||||
$list = scandir("../imageProfil");
|
||||
foreach ($list as $entry) {
|
||||
if (strpos($entry, $mail) !== false) {
|
||||
return "../imageProfil/$entry";
|
||||
}
|
||||
}
|
||||
return "../imageProfil/default.svg";
|
||||
}
|
||||
|
||||
function getPathImgProfil($mail)
|
||||
{
|
||||
$list = scandir("../imageProfil");
|
||||
foreach ($list as $entry) {
|
||||
if (strpos($entry, $mail) !== false) {
|
||||
return "../imageProfil/$entry";
|
||||
}
|
||||
}
|
||||
return "../imageProfil/default.svg";
|
||||
}
|
||||
|
||||
function supprimerAvatar($mail)
|
||||
{
|
||||
$list = scandir("../imageProfil");
|
||||
foreach ($list as $entry) {
|
||||
if (strpos($entry, $mail) !== false) {
|
||||
unlink("../imageProfil/$entry");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isMailUnique($db, $mail)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE mail = $1;", array($mail));
|
||||
if ($result) {
|
||||
$row = pg_fetch_array($result);
|
||||
return (strcmp($row['mail'], $mail) != 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isLoginUnique($db, $login)
|
||||
{
|
||||
$result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE login = $1;", array($login));
|
||||
if ($result) {
|
||||
$row = pg_fetch_array($result);
|
||||
return (strcmp($row['login'], $login) != 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function creerUtilisateur($db, $mail, $password, $prenom, $nom, $login, $phone, $dateN)
|
||||
{
|
||||
$result = pg_query_params($db, "INSERT INTO Utilisateur VALUES ($1, $2, $3, $4, $5, $6, to_date($7, 'YYYY/MM/DD'), false);", array($mail, $password, $prenom, $nom, $login, $phone, $dateN));
|
||||
return $result;
|
||||
}
|
||||
|
||||
function uploadAvatar($mail, $fic)
|
||||
{
|
||||
$tmp = explode('.', $fic['name']);
|
||||
$extension = end($tmp);
|
||||
$target_file = "../imageProfil/$mail.$extension";
|
||||
$file_tmp = $fic['tmp_name'];
|
||||
$check = getimagesize($file_tmp);
|
||||
if ($check === false or !in_array($extension, array('png', 'jpg', 'jpeg', 'pjpeg', 'jfif', 'pjp'))) {
|
||||
return -1;
|
||||
} else if ($fic['size'] > 2 * 1024 * 1024) {
|
||||
return -2;
|
||||
} else {
|
||||
if (!move_uploaded_file($file_tmp, $target_file)) {
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function deluser($db, $delmail)
|
||||
{
|
||||
$requete = "UPDATE trajet SET mailproposition = $1 WHERE mailproposition = $2;";
|
||||
$result1 = pg_query_params($db, $requete, array('utilisateur_supprime@local', $delmail));
|
||||
$requete = "UPDATE reserver SET mailutilisateur = $1 WHERE mailutilisateur = $2;";
|
||||
$result2 = pg_query_params($db, $requete, array('utilisateur_supprime@local', $delmail));
|
||||
$requete = "DELETE FROM avis WHERE mailemetteur = $1;";
|
||||
$result3 = pg_query_params($db, $requete, array($delmail));
|
||||
$requete = "UPDATE voiture SET mail = $1 WHERE mail = $2;";
|
||||
$result4 = pg_query_params($db, $requete, array('utilisateur_supprime@local', $delmail));
|
||||
$requete = "DELETE FROM utilisateur WHERE mail = $1;";
|
||||
$result5 = pg_query_params($db, $requete, array($delmail));
|
||||
return $result1 && $result2 && $result3 && $result4 && $result5;
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
//Si on est pas connecté redirection vers la page de connexion
|
||||
if (!isset($_SESSION['mail'])) {
|
||||
header('Location: ../index.php');
|
||||
exit();
|
||||
}
|
||||
$mail = $_SESSION['mail'];
|
||||
?>
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
require_once ('../connexionBD.php');
|
||||
|
||||
//Envoyer en json les villes correspondantes au champ de saisie pour les villes
|
||||
if (isset($_GET['search'])){
|
||||
$ville = strtolower(htmlentities(pg_escape_string ($_GET['search'])));
|
||||
$result = pg_query_params($db, "SELECT codepostal, nomville FROM ville WHERE lower(nomVille) like lower($1);", array("%$ville%"));
|
||||
$return_arr = pg_fetch_all($result);
|
||||
echo json_encode($return_arr);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
function addVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab){
|
||||
$requete = "INSERT INTO public.voiture (matricule, marque, modele, nbplaces, anneefab, mail) VALUES ('" . $matricule . "','" . $marque . "','" . $modele . "','" . $nbplaces . "','" . $anneefab . "','" . $_SESSION['mail'] . "');";
|
||||
pg_query($db, $requete);
|
||||
}
|
||||
|
||||
function changeVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab){
|
||||
$requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('" . $matricule . "','" . $marque . "','" . $modele . "','" . $nbplaces . "','" . $anneefab . "') WHERE mail = '" . $_SESSION['mail'] . "';";
|
||||
pg_query($db, $requete);
|
||||
}
|
||||
|
||||
function showVoiture($db){
|
||||
$requete = "SELECT * FROM public.voiture WHERE voiture.mail = '" . $_SESSION['mail'] . "';";
|
||||
if ($donnees = pg_query($db, $requete)) {
|
||||
while ($res = pg_fetch_assoc($donnees)) {
|
||||
echo "matricule = ".$res['matricule']."<br>";
|
||||
echo "marque = ".$res['marque']."<br>";
|
||||
echo "modele = ".$res['modele']."<br>";
|
||||
echo "nombre de places = ".$res['nbplaces']."<br>";
|
||||
echo "année de fabrication = ".$res['anneefab']."<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
Before Width: | Height: | Size: 259 KiB After Width: | Height: | Size: 259 KiB |
Before Width: | Height: | Size: 250 KiB After Width: | Height: | Size: 250 KiB |
Before Width: | Height: | Size: 889 KiB After Width: | Height: | Size: 889 KiB |
Before Width: | Height: | Size: 887 KiB After Width: | Height: | Size: 887 KiB |
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |