commit histoire de pas tout perdre

This commit is contained in:
remi.biette 2019-05-22 22:52:03 +02:00
parent 58e5e866a9
commit 4eafe9558d
18 changed files with 496 additions and 257 deletions

View File

@ -7,9 +7,9 @@ Page CSS : avis_laisses.css
body {
color:black;
background-color:white;
background-image:url(../resources/background.jpg);
background-image:url("../ressources/image/background.jpg");
background-repeat:no-repeat;
background-size:104%;
background-size:100%;
margin: 0;
font-family: Ubuntu,Helvetica,sans-serif;
}
@ -40,7 +40,7 @@ h2{
height:50px;
}
#avis_tab{
.avis_tab{
width:85%;
padding-left:15%;
}

View File

@ -1,7 +1,7 @@
<?php
session_start();
require_once (../connexionBD.php);
require_once (../ressources/user.php);
require_once ("../connexionBD.php");
require_once ("../ressources/user.php");
//Si on est pas connecté redirection vers la page de connexion
if (!isset($_SESSION['mail'])) {
@ -12,18 +12,8 @@ $mail = $_SESSION['mail'];
$login = getLogin($db,$mail);
$requete_commentaire = "SELECT commentaire FROM Avis WHERE Avis.mail = $mail";
$requete_dateAvis = "SELECT dateAvis FROM Avis WHERE Avis.mail = $mail";
$requete_note = "SELECT note FROM Avis WHERE Avis.mail = $mail";
$result_commentaire = pg_query_params($db, $requete_commentaire);
$resulttab_commentaire = pg_fetch_array($result_commentaire);
$result_dateAvis = pg_query_params($db, $requete_dateAvis);
$resulttab_dateAvis = pg_fetch_array($result_dateAvis);
$result_note = pg_query_params($db, $requete_note);
$resulttab_note = pg_fetch_array($result_note);
$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));
?>
@ -42,45 +32,39 @@ $resulttab_note = pg_fetch_array($result_note);
<div id = "container">
<div id ="entete">
<a href = "https://stri.flavien.ovh/tableauBord/tableauBord.php"><img id = "bouton_retour" src = "../resources/return.png" alt = "Bouton retour"></a>
<a href = "https://stri.flavien.ovh/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>
<tr>
<td id="avis_tab">
<?PHP
$i=0;
while (strlen($resulttab_commentaire)>$i){
echo "<h3 id=\"nom\"> $login </h3>"
echo "<h4 id=\"date\"> $resulttab_dateAvis[$i] </h4>"
echo "<h5 id=\"avis\"> $resulttab_dateAvis[$i] </h5>"
$i++;
}
?>
</td>
<td id="note_tab">
<?php
$j=0;
while (strlen($resulttab_note)>$j){
if ($resulttab_note[$j]==0){
echo "<img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\">";
}
else if ($resulttab_note[$j]==1) {
echo "<img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\">";
}
else if ($resulttab_note[$j]==2) {
echo "<img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\">";
}
else {
echo "<img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\">";
}
$i++;
}
?>
</td>
<?php
while ($row = pg_fetch_array($result)) {
$nom = $row['login'];
$date = $row['dateavis'];
$commentaire = $row['commentaire'];
$note = $row['note'];
echo "<tr>";
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)){
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>

View File

@ -7,7 +7,7 @@ Page CSS : avis_recu.css
body {
color:black;
background-color:white;
background-image:url(../resources/background.jpg);
background-image:url("../ressources/image/background.jpg");
background-repeat:no-repeat;
background-size:104%;
margin: 0;
@ -40,7 +40,7 @@ h2{
height:50px;
}
#avis_tab{
.avis_tab{
width:85%;
padding-left:15%;
}

View File

@ -1,7 +1,7 @@
<?php
session_start();
require_once (../connexionBD.php);
require_once (../ressources/user.php);
require_once("../connexionBD.php");
require_once("../ressources/user.php");
//Si on est pas connecté redirection vers la page de connexion
if (!isset($_SESSION['mail'])) {
@ -10,73 +10,60 @@ if (!isset($_SESSION['mail'])) {
}
$mail = $_SESSION['mail'];
$login = getLogin($db,$mail);
$login = getLogin($db, $mail);
$requete_commentaire = "SELECT commentaire FROM Avis WHERE Avis.mail != $mail";
$requete_dateAvis = "SELECT dateAvis FROM Avis WHERE Avis.mail != $mail";
$requete_note = "SELECT note FROM Avis WHERE Avis.mail != $mail";
$requete_login = "SELECT login FROM Avis WHERE Avis.mail != $mail";
$result_commentaire = pg_query_params($db, $requete_commentaire);
$resulttab_commentaire = pg_fetch_array($result_commentaire);
$result_dateAvis = pg_query_params($db, $requete_dateAvis);
$resulttab_dateAvis = pg_fetch_array($result_dateAvis);
$result_note = pg_query_params($db, $requete_note);
$resulttab_note = pg_fetch_array($result_note);
$result_login = pg_query_params($db, $requete_login);
$resulttab_login = pg_fetch_array($result_login);
$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="icon" href="../ressources/favicon.ico" />
<title>Avis Recus</title>
<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>
<div id = "container">
<div id ="entete">
<a href = "https://stri.flavien.ovh/tableauBord/tableauBord.php"><img id = "bouton_retour" src = "../resources/return.png" alt = "Bouton retour"></a>
<h1 id = "titre">Avis Recus</h1>
<br>
</div>
<div id = "avis">
<table>
<tr>
<td id="avis_tab">
<?php
$i=0;
while (strlen($resulttab_commentaire)>$i){
echo "<h3 id=\"nom\"> $resulttab_login[$i]</h3>"
echo "<h4 id=\"date\"> $resulttab_dateAvis[$i] </h4>"
echo "<h5 id=\"avis\"> $resulttab_dateAvis[$i] </h5>"
$i++;
}
?>
</td>
<td id="note_tab">
<?php
if ($note==0){
echo "<img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\">";
}
elseif ($note==1){
echo "<img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\">";
}
elseif ($note==2){
echo "<img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star.png\" alt=\"star\">";
}
else {
echo "<img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\"><img class=\"etoile\" src=\"../resources/star_full.png\" alt=\"star\">";
}
?>
</td>
</tr>
</table>
<?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 id="titre">Avis Recus</h1>
<br>
</div>
</div>
<div id="avis">
<table>
<?php while ($row = pg_fetch_array($result)) {
$nom = $row['login'];
$date = $row['dateavis'];
$commentaire = $row['commentaire'];
$note = $row['note'];
echo "<tr>";
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)){
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>

View File

@ -5,11 +5,11 @@
}
body{
background-image:url("../ressources/image/background.jpg");
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: center;
align-items: center;
}
h1{
@ -52,6 +52,7 @@ h1{
}
#formulaire{
margin-top: ;
background-color: white;
border-radius: 10px;
padding: 4em;

View File

@ -1,4 +1,5 @@
<?php
session_start();
require_once('../connexionBD.php');
require_once('../ressources/trajet.php');
require_once ('../ressources/verifconnecte.php');
@ -100,7 +101,11 @@ if (isset($_POST['dateDepart']) && isset($_POST['dateArrivee']) && isset($_POST[
<input id="supprimerEtape" class='button' type='button' value='Supprimer une étape'>
<input id="nbEtapes" name="nbEtapes" type="hidden" value="1" required>
</div>
<?php getErrorDepotTrajet($_GET['error']); ?>
<?php
if (isset($_GET['error'])){
getErrorDepotTrajet($_GET['error']);
}
?>
<div class="line">
<input id="submit" class="button" type="submit" value="Poster le trajet">
</div>

View File

@ -1,14 +1,7 @@
/*
Crée par PALAFFRE Raphael
Fonction:Depot d'avis
Page PHP : deposer_avis.php
Page HTML : deposer_avis.html
*/
body {
color:black;
background-color:white;
background-image:url(../resources/background.jpg);
background-image:url("../ressources/image/background.jpg");
background-repeat:no-repeat;
background-size:104%;
margin: 0;
@ -32,7 +25,10 @@ h1{
}
#avis_laisse{
resize: none
box-sizing: border-box;
resize: none;
width: 70%;
height: 16em;
}
#submit{

View File

@ -1,7 +1,22 @@
<?php
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 avis av, trajet tr, reserver re WHERE av.codetrajet = $2 AND av.codetrajet = tr.codetrajet AND tr.codetrajet = re.codetrajet AND re.mailutilisateur = $1;", array($mail, $codetrajet));
$row = pg_fetch_array($result);
return $row[0] >= 1;
}
session_start();
require_once (../connexionBD.php);
require_once (../ressources/user.php);
require_once("../connexionBD.php");
require_once("../ressources/user.php");
//Si on est pas connecté redirection vers la page de connexion
if (!isset($_SESSION['mail'])) {
@ -11,65 +26,61 @@ if (!isset($_SESSION['mail'])) {
$mail = $_SESSION['mail'];
if (isset($_GET['codeTrajet'])) {
$mail = $_SESSION['mail'];
$avis = $_POST['avis_laisse'];
$note = $_POST['note'];
$date = date("Y-m-d H:i:s");
$estLu = 0;
$codeTrajet = $_GET['codeTrajet'];
$requete = "INSERT INTO Avis(mailEmetteur,codeTrajet,commentaire,dateAvis,note,estLu) VALUES ($mail,$codeTrajet,$avis,$date,$note,$estLu);";
$envoi = pg_query($db,$requete);
if ($envoi == FALSE){
echo 'Erreur d\'ecriture dans la BD';
}
}
else{
echo 'Erreur codeTrajet';
if (isset($_POST['codetrajet']) && isset($_POST['avislaisse']) && isset($_POST['note'])) {
$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);";
$envoi = pg_query_params($db, $requete, array($mail, $codetrajet, $avis, $date, $note));
if (!$envoi) {
echo "Erreur d'ecriture dans la BD";
exit();
} else {
header('Location: ../index.php');
exit();
}
}
}
?>
<!DOCTYPE html>
<html lang = "fr">
<html lang="fr">
<head>
<!--
Crée par PALAFFRE Raphael
Fonction:Depot d'avis
Page PHP : deposer_avis.php
Page CSS : deposer_avis.css
-->
<meta charset = "UTF-8">
<link rel = "stylesheet" href = "deposer_avis.css">
<link rel="icon" href="../ressources/favicon.ico" />
<title>Deposer un avis</title>
<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>
<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">
<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>
</div>
<br>
<div>
<input type="submit" value="Valider" id="submit">
</div>
</form>
</div>
</div>
<?php require_once("../ressources/navbarhtml.php"); ?>
<div id="container">
<div id="entete">
<h1 id="titre">Deposer un avis</h1>
</div>
<div id="form">
<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>
<h2>NOTE</h2>
<div class="rating">
<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">
</form>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,54 @@
/*
Crée par PALAFFRE Raphael
Fonction: Lister les trajets recherché
Page PHP : liste.php
*/
body {
color:black;
background-color:white;
background-image:url(../resources/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;
}
#bouton_retour{
transform : rotate(45deg);
}
.separation{
margin-top : 5%;
margin-left : 20%;
height: 200px;
width : 5px;
background: black;
}
#ligne{
padding-left:10%;
width: 33%;
}
#info{
width: 60%;
}

View File

@ -0,0 +1,49 @@
<?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="icon" href="../ressources/favicon.ico"/>
<title>Liste des trajets</title>
</head>
<body>
<div id="container">
<div id="entete">
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour" src="../resources/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;", 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><td class='info'>";
echo "<p>$date_depart - $source --> $dest : $login</p></td>";
echo "</tr>";
}
?>
</table>
</div>
</div>
</body>
</html>

View File

@ -1,6 +1,6 @@
<?php
session_start();
require_once (../connexionBD.php);
require_once ("../connexionBD.php");
//Si on est pas connecté redirection vers la page de connexion
if (!isset($_SESSION['mail'])) {
@ -59,8 +59,8 @@ if ($envoi == FALSE){
<td id="reserver">
<form action="contact.php" method="POST">
<?php
echo "<input type=\"hidden\" name=\"login\" value=\"$login\"/>";
echo "<input type=\"hidden\" name=\"codeTrajet\" value=\"$codeTrajet\"/>";
echo "<input type='hidden' name='login' value='$login'/>";
echo "<input type='hidden' name='codeTrajet' value='$codeTrajet'/>";
?>
<input type="submit" value="Reserver">
</form>

View File

@ -28,3 +28,116 @@
#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;
}

View File

@ -4,7 +4,6 @@ require_once('../connexionBD.php');
require_once ('../ressources/user.php');
require_once ('../ressources/voiture.php');
$mail = $_SESSION['mail'];
$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;
@ -15,9 +14,14 @@ if (!isset($_SESSION['mail'])) {
header('Location: index.php');
exit();
}
$mail = $_SESSION['mail'];
if (isset($_POST['submitadd'])) {
addVoiture($db, $matricule, $marque, $modele, $nbplaces, $anneefab);
$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);
@ -88,7 +92,6 @@ if (isset($_POST['login']) || isset($_FILES['avatar'])){
<meta charset="UTF-8">
<link rel="stylesheet" href="profil.css">
<link rel="stylesheet" href="../ressources/navbarhtml.css">
<link rel="stylesheet" href="../index.css">
<script src="../inscription/inscription.js"></script>
<title>Profil</title>
</head>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

@ -1,18 +1,12 @@
<?php
$path = "..";
if (file_exists("./inscription.php")) {
$path = ".";
}
?>
<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="<?php echo $path ; ?>../tableauBord/tableauBord.php">Tableau de bord</a>
<a class="menuItem" href="<?php echo $path ; ?>/inscription.php">Trajets publiés</a>
<a class="menuItem" href="<?php echo $path ; ?>/inscription.php">Trajets réservés</a>
<a class="menuItem" href="<?php echo $path ; ?>../avis_recus/avis_recus.php">Avis reçus</a>
<a class="menuItem" href="<?php echo $path ; ?>../avis_laisses/avis_laisses.php">Avis laissés</a>
<a class="menuItem" href="<?php echo $path ; ?>../profil/profil.php">Profil</a>
<a class="menuItem" href="<?php echo $path ; ?>../deconnexion.php">Se déconnecter</a>
<a class="menuItem" href="../tableauBord/tableauBord.php">Tableau de bord</a>
<a class="menuItem" href="/inscription.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>

View File

@ -100,6 +100,24 @@ function afficherVilles($db){
}
}
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 getErrorDepotTrajet($code){
switch ($code) {
case 1:

View File

@ -1,30 +1,33 @@
<?php
//geterror de l'index
function getErrorIndex($code){
switch ($code){
case 1:
return "Adresse mail ou mot de passe invalide.";
}
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 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){
function getErrorInscription($code)
{
switch ($code) {
case 1:
return "L'adresse mail est invalide.";
@ -41,20 +44,23 @@ function getErrorInscription($code){
}
}
function authentification($db, $mail, $password){
function authentification($db, $mail, $password)
{
$result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE mail = $1;", array($mail));
if ($result){
if ($result) {
$row = pg_fetch_array($result);
return (strcmp($row["passwd"], $password)) == 0;
}
return false;
}
function loginChange($user, $login){
function loginChange($user, $login)
{
return strcmp($user['login'], $login);
}
function isLoginUniqueModifier($db, $mail, $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);
@ -63,22 +69,26 @@ function isLoginUniqueModifier($db, $mail, $login){
return false;
}
function modifierLogin($db, $mail, $login){
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){
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){
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){
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);
@ -88,7 +98,8 @@ function getPrenom($db, $mail){
return false;
}
function getLogin($db, $mail){
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);
@ -98,7 +109,8 @@ function getLogin($db, $mail){
return false;
}
function getPathImgProfilTableau($mail){
function getPathImgProfilTableau($mail)
{
$list = scandir("../imageProfil");
foreach ($list as $entry) {
if (strpos($entry, $mail) !== false) {
@ -108,7 +120,8 @@ function getPathImgProfilTableau($mail){
return "../imageProfil/default.svg";
}
function getPathImgProfil($mail){
function getPathImgProfil($mail)
{
$list = scandir("../imageProfil");
foreach ($list as $entry) {
if (strpos($entry, $mail) !== false) {
@ -118,7 +131,8 @@ function getPathImgProfil($mail){
return "../imageProfil/default.svg";
}
function supprimerAvatar($mail){
function supprimerAvatar($mail)
{
$list = scandir("../imageProfil");
foreach ($list as $entry) {
if (strpos($entry, $mail) !== false) {
@ -127,7 +141,8 @@ function supprimerAvatar($mail){
}
}
function isMailUnique($db, $mail){
function isMailUnique($db, $mail)
{
$result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE mail = $1;", array($mail));
if ($result) {
$row = pg_fetch_array($result);
@ -136,7 +151,8 @@ function isMailUnique($db, $mail){
return false;
}
function isLoginUnique($db, $login){
function isLoginUnique($db, $login)
{
$result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE login = $1;", array($login));
if ($result) {
$row = pg_fetch_array($result);
@ -145,12 +161,14 @@ function isLoginUnique($db, $login){
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 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){
function uploadAvatar($mail, $fic)
{
$tmp = explode('.', $fic['name']);
$extension = end($tmp);
$target_file = "../imageProfil/$mail.$extension";
@ -161,30 +179,36 @@ function uploadAvatar($mail, $fic){
} else if ($fic['size'] > 2 * 1024 * 1024) {
return -2;
} else {
if(!move_uploaded_file($file_tmp, $target_file)){
if (!move_uploaded_file($file_tmp, $target_file)) {
return -3;
}
}
return 0;
}
function deluser($delmail){
/*
$requete = "UPDATE public.utilisateur SET (mail, passwd, prenom, nom, login, telephone, datenaissance, estadmin) = ('utilisateur_supprime@local', '', '', '', 'utilisateur_supprime', '', to_date('1970/01/01','YYYY/MM/DD'), false) WHERE mail = '".$delmail."';";
marche pas
ERROR: duplicate key value violates unique constraint "pk_utilisateur"
DETAIL: Key (mail)=(utilisateur_supprime@local) already exists.
*/
function deluser($db, $delmail)
{
/*
$requete = "UPDATE public.utilisateur SET (mail, passwd, prenom, nom, login, telephone, datenaissance, estadmin) = ('utilisateur_supprime@local', '', '', '', 'utilisateur_supprime', '', to_date('1970/01/01','YYYY/MM/DD'), false) WHERE mail = '".$delmail."';";
marche pas
ERROR: duplicate key value violates unique constraint "pk_utilisateur"
DETAIL: Key (mail)=(utilisateur_supprime@local) already exists.
*/
/*
a faire = array('' => , );Delete l'utilisateur du reste de la base
*/
/*
a faire = array('' => , );Delete l'utilisateur du reste de la base
*/
$requete = "UPDATE trajet SET mailproposition = 'utilisateur_supprime@local' WHERE mailproposition = $delmail;";
pg_query($db, $requete);
$requete = "UPDATE reserver SET mailutilisateur = 'utilisateur_supprime@local' WHERE mailutilisateur = $delmail;";
pg_query($db, $requete);
$requete = "DELETE FROM avis WHERE mailemetteur = $delmail;";
pg_query($db, $requete);
$requete = "DELETE FROM voiture WHERE mail = $delmail;";
pg_query($db, $requete);
$requete = "DELETE FROM utilisateur WHERE mail = $delmail;";
pg_query($db, $requete);
$requete = "DELETE FROM public.utilisateur WHERE mail = '".$delmail."';";
if(pg_query($db, $requete)){
supprimerAvatar($delmail);
echo "c'est supprimé";
}
}
?>

View File

@ -23,7 +23,7 @@ require_once ('../ressources/verifconnecte.php');
<img id="imgProfil" src="<?php echo getPathImgProfilTableau($mail); ?>">
</div>
<div id="trajet">
<a class="btnTrajet" href="../ah.php">Déposer un trajet</a>
<a class="btnTrajet" href="../deposerTrajet/depotTrajet.php">Déposer un trajet</a>
<a id="btnTrajet2" class="btnTrajet" href="../ah.php">Rechercher un trajet</a>
</div>
<div id="recap">