Compare commits

..

No commits in common. 'master' and 'messagerie' have entirely different histories.

@ -0,0 +1,34 @@
.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;
}

@ -0,0 +1,53 @@
<!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,11 +1,10 @@
body {
color:black;
background-color:white;
background-image:url("../ressources/image/background.jpg");
background-image:url(background.jpg);
background-repeat:no-repeat;
background-size:104%;
margin: 0;
font-family: Ubuntu,Helvetica,sans-serif;
}
#container{
@ -17,13 +16,11 @@ body {
h1{
text-align : center;
font-size : 250%;
font-weight: bold;
}
h2{
text-align : center;
font-size : 150%;
font-weight: bold;
}
#bouton_retour{
@ -32,14 +29,8 @@ h2{
.separation{
margin-top : 5%;
margin-left : 20%;
min-height: 2em;
margin-left : 10%;
height: 200px;
width : 5px;
background: black;
}
td{
padding-left: 1.5em;
padding-right: 1.5em;
width: 25%;
}

@ -0,0 +1,29 @@
<?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>

@ -1,44 +0,0 @@
/*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%;
}

@ -1,81 +0,0 @@
<?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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

@ -1,44 +0,0 @@
/*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%;
}

@ -1,76 +0,0 @@
<?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>

@ -0,0 +1,19 @@
<?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;
}
?>

@ -1,7 +0,0 @@
<?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,11 +1,21 @@
<?php
/**
* Created by PhpStorm.
* User: REMI
* Date: 19/04/2019
* Time: 10:10
*/
require_once ('connexionBD.php');
require 'connectionBD.php';
$db = connexionBD();
init();
session_start();
if (isset($_SESSION['mail'])){
session_unset();
session_destroy();
function init(){
session_start();
if (isset($_SESSION['mail'])){
session_unset();
session_destroy();
}
header('Location: index.php');
exit();
}
header('Location: index.php');

@ -1,96 +0,0 @@
*{
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;
}

@ -1,55 +0,0 @@
$(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();
}
}
});
});

@ -1,118 +0,0 @@
<?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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

@ -1,13 +1,10 @@
/*General*/
body {
color:black;
background-color:white;
background-image:url("../ressources/image/background.jpg");
background-image:url(background.jpg);
background-repeat:no-repeat;
background-size:104%;
margin: 0;
font-family: Ubuntu,Helvetica,sans-serif;
}
#container{
@ -19,39 +16,29 @@ body {
h1{
text-align : center;
font-size : 250%;
font-weight: bold;
}
/*Formulaire*/
#form{
text-align:center;
}
#avis_laisse{
box-sizing: border-box;
resize: none;
width: 70%;
height: 16em;
resize: none
}
#submit{
margin-bottom: 1%;
}
/*Etoile de notation*/
.rating {
direction: rtl;
}
.rating a {
color: #aaa;
text-decoration: none;
font-size: 3em;
transition: color .4s;
}
.rating a:hover,
.rating a:focus,
.rating a:hover ~ a,

@ -0,0 +1,40 @@
<!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>

@ -1,92 +0,0 @@
<?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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

@ -1,35 +1,71 @@
<?php
session_start();
require_once("connexionBD.php");
require_once ('./ressources/user.php');
if(!isset($_SESSION['mail'])){
if (isset($_POST['mail_field'])){
$mail = strtolower(htmlentities(pg_escape_string ($_POST['mail_field'])));
$password = htmlentities(pg_escape_string($_POST['password']));
$result = authentification($db, $mail, $password);
if($result) {
$_SESSION['mail'] = $mail;
header('Location: tableauBord/tableauBord.php');
exit();
require("connectionBD.php");
$db = connexionBD();
init();
function printError(){
if(isset($_GET['error'])){
$erreur = getError($_GET['error']);
echo "<p class = 'error'>$erreur</p>";
}
}
function getError($code){
switch ($code){
case 1:
return "Adresse mail ou mot de passe invalide.";
}
}
function authentification($mail, $password){
global $db;
$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 init(){
global $db;
session_start();
/*if(isset($_COOKIE['mail']) && isset($_COOKIE['password'])){
if (authentification($_COOKIE['mail'], $_COOKIE['mail'])){
$_SESSION['mail'] = $_COOKIE['mail'];
}
else {
header('Location: index.php?error=1');
exit();
}*/
if(!isset($_SESSION['mail'])){
if (isset($_POST['mail_field'])){
$mail = strtolower(htmlentities(pg_escape_string ($_POST['mail_field'])));
$password = htmlentities(pg_escape_string($_POST['password']));
$result = authentification($mail, $password);
if($result) {
$_SESSION['mail'] = $mail;
header('Location: tableauBord/tableauBord.php');
exit();
}
else {
header('Location: index.php?error=1');
exit();
}
}
}
else{
header('Location: tableauBord/tableauBord.php');
exit();
}
}
else{
header('Location: tableauBord/tableauBord.php');
exit();
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="index.css">
<link rel="stylesheet" href="index_inscription.css">
<title>Bienvenue sur Upssi'Covoit</title>
</head>
<body>
@ -46,13 +82,13 @@ else{
</div>
<?php
if(isset($_GET['error'])){
$erreur = getErrorIndex($_GET['error']);
$erreur = getError($_GET['error']);
echo "<p class = 'error'>$erreur</p>";
}
?>
<input id="submit" class="button" type="submit" value="Se connecter">
</form>
<p id="enregistrer">Si vous n'avez pas de compte <a href="./inscription/inscription.php" title="Créer un compte">cliquez ici</a>.</p>
<p id="enregistrer">Si vous n'avez pas de compte <a href="inscription.php" title="Créer un compte">cliquez ici</a>.</p>
</div>
</body>
</html>

@ -0,0 +1,182 @@
<?php
require ('connectionBD.php');
$db = connexionBD();
init();
function printError(){
if(isset($_GET['error'])){
$erreur = getError($_GET['error']);
echo "<p class = 'error'>$erreur</p>";
}
}
function getError($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 isMailUnique($mail){
global $db;
$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($login){
global $db;
$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($mail, $password, $prenom, $nom, $login, $phone, $dateN){
global $db;
$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){
if(isset($_FILES['avatar']) and $_FILES['avatar']['name'] != "") {
$target_file = "imageProfil/$mail.png";
$file_tmp = $_FILES['avatar']['tmp_name'];
$extension = end(explode('.', $_FILES['avatar']['name']));
$check = getimagesize($file_tmp);
if($check === false or !in_array($extension, array('png'))) {
header('Location: inscription.php?error=4');
exit();
}
else if ($_FILES['avatar']['size'] > 2 * 1024 * 1024){
header('Location: inscription.php?error=5');
exit();
}
else{
move_uploaded_file($file_tmp, $target_file);
}
}
}
function init(){
session_start();
if(!isset($_SESSION['mail'])){
if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST) && empty($_FILES) && $_SERVER['CONTENT_LENGTH'] > 0 ){
echo "<p class='error'>PHP a ignoré les données POST à cause d'une requête dépassant post_max_size (".ini_get('post_max_size').").</p>";
exit();
}
if(isset($_POST['mail_field'])){
$login = htmlentities(pg_escape_string ($_POST['login_field']));
$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_field'])));
$phone = htmlentities(pg_escape_string ($_POST['phone']));
if(!filter_var($mail, FILTER_VALIDATE_EMAIL)){
header('Location: inscription.php?error=1');
exit();
}
elseif(!isMailUnique($mail)){
header('Location: inscription.php?error=2');
exit();
}
elseif(!isLoginUnique($login)){
header('Location: inscription.php?error=3');
exit();
}
else{
uploadAvatar($mail);
$result = creerUtilisateur($mail, $password, $prenom, $nom, $login, $phone, $dateN);
if($result){
header('Location: index.php');
}
else{
header('Location: inscription.php?error=6');
}
}
}
}
else{
header('Location: tableauBord/tableauBord.php');
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="index_inscription.css">
<title>Inscription</title>
<script src="inscription.js"></script>
</head>
<body>
<div id="formulaire">
<h1>Inscription</h1>
<form method="post" enctype="multipart/form-data" action="inscription.php">
<div class="line">
<label for="mail_field">Adresse mail : </label>
<input id="mail_field" class="form" name="mail_field" type="email" maxlength="100" required>
</div>
<div class="line">
<label for="login_field">Login : </label>
<input id="login_field" class="form" name="login_field" 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_field">Prénom : </label>
<input id="prenom_field" class="form" name="prenom" type="text" maxlength="50" required>
</div>
<div class="line">
<label for="nom_field">Nom : </label>
<input id="nom_field" class="form" name="nom" type="text" maxlength="50" required>
</div>
<div class="line">
<label for="dateN_field">Date de naissance : </label>
<input id="dateN_field" class="form" name="dateN" type="date" required>
</div>
<div class="line">
<label for="phone_field">Numéro de téléphone : </label>
<input id="phone_field" 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">
</div>
<?php
printError();
?>
<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>
</body>
</html>

@ -1,109 +0,0 @@
*{
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;
}

@ -1,117 +0,0 @@
<?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>

@ -1,18 +0,0 @@
<?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();

@ -1,56 +0,0 @@
<?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>

@ -1,18 +0,0 @@
<?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();

@ -1,55 +0,0 @@
<?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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

@ -1,11 +1,10 @@
body {
color:black;
background-color:white;
background-image:url("../ressources/image/background.jpg");
background-image:url(background.jpg);
background-repeat:no-repeat;
background-size:104%;
margin: 0;
font-family: Ubuntu,Helvetica,sans-serif;
}
#container{
@ -17,13 +16,11 @@ body {
h1{
text-align : center;
font-size : 250%;
font-weight: bold;
}
h2{
text-align : center;
font-size : 150%;
font-weight: bold;
}
#bouton_retour{
@ -32,18 +29,8 @@ h2{
.separation{
margin-top : 5%;
margin-left : 20%;
min-height: 2em;
margin-left : 10%;
height: 200px;
width : 5px;
background: black;
}
td{
padding-left: 1.5em;
padding-right: 1.5em;
width: 33%;
}
#info{
width: 60%;
}
}

@ -0,0 +1,33 @@
<?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>

@ -1,53 +0,0 @@
/*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%;
}

@ -1,81 +0,0 @@
<?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>

@ -1,38 +0,0 @@
<?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();
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

@ -1,48 +0,0 @@
<?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>

@ -1,143 +0,0 @@
*{
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;
}

@ -1,268 +0,0 @@
<?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>

@ -1,40 +0,0 @@
.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;
}

@ -1,54 +0,0 @@
<?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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

@ -1,59 +0,0 @@
#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;
}

@ -1,12 +0,0 @@
<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>

@ -1,55 +0,0 @@
#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);
}

@ -1,23 +0,0 @@
<?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>";
}
?>

@ -1,197 +0,0 @@
<?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.";
}
}
?>

@ -1,204 +0,0 @@
<?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;
}
?>

@ -1,8 +0,0 @@
<?php
//Si on est pas connecté redirection vers la page de connexion
if (!isset($_SESSION['mail'])) {
header('Location: ../index.php');
exit();
}
$mail = $_SESSION['mail'];
?>

@ -1,11 +0,0 @@
<?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);
}

@ -1,24 +0,0 @@
<?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>";
}
}
}
?>

@ -1,7 +1,7 @@
*{
margin: 0;
padding: 0;
font-family: "Arial";
font-family: "Calibri Light";
}
h1{
@ -25,6 +25,35 @@ h1{
width: 100%;
}
.menu {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
background-color: rgb(65, 154, 28);
}
.menuItem {
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: center;
color: white;
width: 10%;
min-width: 5em;
font-weight: bold;
text-decoration: none;
padding: 0.8em;
border-bottom: 4px solid rgb(65, 154, 28);
font-size: 1.1em;
text-align: center;
}
.menuItem:hover{
cursor: pointer;
border-bottom: 4px solid orange;
}
#divImgProfil{
width: 100%;
display: flex;

@ -1,49 +1,244 @@
<?php
session_start();
require_once('../connexionBD.php');
require_once ('../ressources/user.php');
require_once ('../ressources/trajet.php');
require_once ('../ressources/verifconnecte.php');
require ('../connectionBD.php');
$mail = null;
$db = connexionBD();
init();
$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']))
{
addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab);
}
if(isset($_POST['submitchange']))
{
changeVoiture($matricule, $marque, $modele, $nbplaces, $anneefab);
}
if(isset($_POST['submitshow']))
{
showVoiture();
}
function init(){
session_start();
global $mail;
//Si on est pas connecté redirection vers la page de connexion
if(!isset($_SESSION['mail'])){
header('Location: ../index.php');
exit();
}
else{
$mail = $_SESSION['mail'];
}
}
function getPrenom($mail){
global $db;
$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 null;
}
function getLogin($mail){
global $db;
$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 null;
}
function getTrajetsProposes($mail){
global $db;
$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($mail){
global $db;
$result = pg_query_params($db, "SELECT COUNT(*) FROM trajet tr, reserver r WHERE r.codetrajet = tr.codetrajet AND mailutilisateur = $1 AND etatres != 'Annulée' AND estAnnule = false AND datedepart >= current_date;", array($mail));
if($result){
$row = pg_fetch_array($result);
return $row[0];
}
return 0;
}
function getMessagesNonLus($mail){
global $db;
$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($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;
}
}
function getPathImgProfil($mail){
if (file_exists("../imageProfil/$mail.png")){
return "../imageProfil/$mail.png";
}
return "../imageProfil/default.svg";
}
function addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){
global $db;
$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($matricule, $marque, $modele, $nbplaces, $anneefab){
global $db;
$requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."') WHERE mail = '".$_SESSION['mail']."';";
echo "requete =".$requete;
pg_query($db, $requete);
}
function showVoiture(){
global $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>";
}
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="tableauBord.css">
<link rel="stylesheet" href="../ressources/navbarhtml.css">
<link rel="icon" type="image/png" href=""/>
<link rel="icon" type="image/png" href="" />
<title>Tableau de bord</title>
<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>
<nav class="menu">
<a class="menuItem" href="./../inscription.php">Tableau de bord</a>
<a class="menuItem" href="../inscription.php">Trajets publiés</a>
<a class="menuItem" href="../inscription.php">Trajets réservés</a>
<a class="menuItem" href="../inscription.php">Messagerie</a>
<a class="menuItem" href="../inscription.php">Avis reçus</a>
<a class="menuItem" href="../inscription.php">Avis laissés</a>
<a class="menuItem" href="../inscription.php">Profil</a>
<a class="menuItem" href="../deconnexion.php">Se déconnecter</a>
</nav>
</head>
<body>
<?php require('../ressources/navbarhtml.php'); ?>
<div id="content">
<div id="tableauBord">
<h1>Bienvenue <?php echo getLogin($db, $mail); ?></h1>
<h1>Bienvenue <?php echo getLogin($mail); ?></h1>
<div id="divImgProfil">
<img id="imgProfil" src="<?php echo getPathImgProfilTableau($mail); ?>">
<img id="imgProfil" src="<?php echo getPathImgProfil($mail); ?>">
</div>
<div id="trajet">
<a class="btnTrajet" href="../deposerTrajet/depotTrajet.php">Déposer un trajet</a>
<a id="btnTrajet2" class="btnTrajet" href="../recherche/recherche.php">Rechercher un trajet</a>
<a class="btnTrajet" href="../ah.php">Déposer un trajet</a>
<a id="btnTrajet2" class="btnTrajet" href="../ah.php">Rechercher un trajet</a>
</div>
<div id="recap">
<div class="recapLine">
<img class="recapIcon" src="../car.png">
<p>Vous avez <?php echo getTrajetsProposes($db, $mail); ?> trajets proposés à effectuer.</p>
<p>Vous avez <?php echo getTrajetsProposes($mail); ?> trajets proposés à effectuer.</p>
</div>
<div class="recapLine">
<img class="recapIcon" src="../car.png">
<p>Vous avez <?php echo getTrajetsReserves($db, $mail); ?> trajets réservés à effectuer.</p>
<p>Vous avez <?php echo getTrajetsReserves($mail); ?> trajets réservés à effectuer.</p>
</div>
<div class="recapLine">
<img class="recapIcon" src="../mail.svg">
<p>Vous avez <?php echo getMessagesNonLus($db, $mail); ?> messages non lus.</p>
<p>Vous avez <?php echo getMessagesNonLus($mail); ?> messages non lus.</p>
</div>
<div class="recapLine">
<img class="recapIcon" src="../star.png">
<p>Vous avez <?php echo getAvisNonLus($db, $mail); ?> avis non lus.</p>
<p>Vous avez <?php echo getAvisNonLus($mail); ?> avis non lus.</p>
</div>
</div>
<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="tableauBord.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="tableauBord.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="tableauBord.php" method="post">
<table>
<tr><td><p><input type="submit" name="submitshow" value="afficher ma voiture"></td></tr>
</table>
</form>
</fieldset>
</div>
</div>
</div>
</body>

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

Loading…
Cancel
Save