diff --git a/WEB/avis_laisses/avis_laisses.css b/WEB/avis_laisses/avis_laisses.css index 75e64f3..b28d24b 100755 --- a/WEB/avis_laisses/avis_laisses.css +++ b/WEB/avis_laisses/avis_laisses.css @@ -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%; } diff --git a/WEB/avis_laisses/avis_laisses.php b/WEB/avis_laisses/avis_laisses.php index 3119df3..a6b8511 100755 --- a/WEB/avis_laisses/avis_laisses.php +++ b/WEB/avis_laisses/avis_laisses.php @@ -1,7 +1,7 @@ @@ -42,45 +32,39 @@ $resulttab_note = pg_fetch_array($result_note);
- Bouton retour + Bouton retour

Avis Laissés


- - - + "; + echo ""; + echo ""; + } + ?>
- $i){ - echo "

$login

" - echo "

$resulttab_dateAvis[$i]

" - echo "
$resulttab_dateAvis[$i]
" - $i++; - } - ?> -
- $j){ - if ($resulttab_note[$j]==0){ - echo "\"star\"\"star\"\"star\""; - } - else if ($resulttab_note[$j]==1) { - echo "\"star\"\"star\"\"star\""; - } - else if ($resulttab_note[$j]==2) { - echo "\"star\"\"star\"\"star\""; - } - else { - echo "\"star\"\"star\"\"star\""; - } - $i++; - } - ?> - "; + echo "

$nom

"; + echo "

".explode(' ',$date)[0]."

"; + echo "
$commentaire
"; + echo "
"; + $i=0; + while ($i"; + $i++; + } + $i = $note; + while ($i<3){ + echo "star"; + $i++; + } + echo "
diff --git a/WEB/avis_recus/avis_recus.css b/WEB/avis_recus/avis_recus.css index afc9197..bed344e 100755 --- a/WEB/avis_recus/avis_recus.css +++ b/WEB/avis_recus/avis_recus.css @@ -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%; } diff --git a/WEB/avis_recus/avis_recus.php b/WEB/avis_recus/avis_recus.php index 3c5038b..626727a 100755 --- a/WEB/avis_recus/avis_recus.php +++ b/WEB/avis_recus/avis_recus.php @@ -1,7 +1,7 @@ - - - - Avis Recus + + + + + Avis Recus -
-
- Bouton retour -

Avis Recus

-
-
-
- - - - +
- $i){ - echo "

$resulttab_login[$i]

" - echo "

$resulttab_dateAvis[$i]

" - echo "
$resulttab_dateAvis[$i]
" - $i++; - } - ?> -
- \"star\"\"star\""; - } - elseif ($note==1){ - echo "\"star\"\"star\"\"star\""; - } - elseif ($note==2){ - echo "\"star\"\"star\"\"star\""; - } - else { - echo "\"star\"\"star\"\"star\""; + +
+
+ Bouton retour +

Avis Recus

+
+
+
+ + "; + echo ""; + echo ""; } ?> - - -
"; + echo "

$nom

"; + echo "

".explode(' ',$date)[0]."

"; + echo "
$commentaire
"; + echo "
"; + $i=0; + while ($i"; + $i++; + } + $i = $note; + while ($i<3){ + echo "star"; + $i++; + } + echo "
+
-
+
diff --git a/WEB/deposerTrajet/depotTrajet.css b/WEB/deposerTrajet/depotTrajet.css index 8d7babf..4c5d463 100644 --- a/WEB/deposerTrajet/depotTrajet.css +++ b/WEB/deposerTrajet/depotTrajet.css @@ -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; diff --git a/WEB/deposerTrajet/depotTrajet.php b/WEB/deposerTrajet/depotTrajet.php index ad06b0e..d139cfe 100644 --- a/WEB/deposerTrajet/depotTrajet.php +++ b/WEB/deposerTrajet/depotTrajet.php @@ -1,4 +1,5 @@ - +
diff --git a/WEB/deposer_avis/deposer_avis.css b/WEB/deposer_avis/deposer_avis.css index 88906c9..a93218d 100755 --- a/WEB/deposer_avis/deposer_avis.css +++ b/WEB/deposer_avis/deposer_avis.css @@ -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{ diff --git a/WEB/deposer_avis/deposer_avis.php b/WEB/deposer_avis/deposer_avis.php index 7f9591f..8e138a9 100755 --- a/WEB/deposer_avis/deposer_avis.php +++ b/WEB/deposer_avis/deposer_avis.php @@ -1,7 +1,22 @@ = 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(); + } + } } ?> - + - - - - - Deposer un avis + + + + + Deposer un avis -
-
-

Deposer un avis

-
-
-
-
- -
-

NOTE

-
- - - - - - -
-
-
- -
-
-
-
+ +
+
+

Deposer un avis

+
+
+
+ +

NOTE

+
+ + + + + + + "; + } + ?> +
+
+ +
+
+
diff --git a/WEB/listeTrajetReserve/liste_trajet_reserve.css b/WEB/listeTrajetReserve/liste_trajet_reserve.css new file mode 100644 index 0000000..d85ee2f --- /dev/null +++ b/WEB/listeTrajetReserve/liste_trajet_reserve.css @@ -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%; +} \ No newline at end of file diff --git a/WEB/listeTrajetReserve/liste_trajet_reserve.php b/WEB/listeTrajetReserve/liste_trajet_reserve.php new file mode 100644 index 0000000..a4637ad --- /dev/null +++ b/WEB/listeTrajetReserve/liste_trajet_reserve.php @@ -0,0 +1,49 @@ + + + + + + + + Liste des trajets + + +
+
+ Bouton retour +

Liste des trajets réservés

+
+
+
+ + "; + echo ""; + } + ?> +

"; + echo "

$date_depart - $source --> $dest : $login

+
+
+ + diff --git a/WEB/liste_trajets/liste_trajet.php b/WEB/liste_trajets/liste_trajet.php index cef8c7d..a1f83be 100755 --- a/WEB/liste_trajets/liste_trajet.php +++ b/WEB/liste_trajets/liste_trajet.php @@ -1,6 +1,6 @@
"; - echo ""; + echo ""; + echo ""; ?>
diff --git a/WEB/profil/profil.css b/WEB/profil/profil.css index cd01b65..d549f29 100644 --- a/WEB/profil/profil.css +++ b/WEB/profil/profil.css @@ -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; +} diff --git a/WEB/profil/profil.php b/WEB/profil/profil.php index 1bed13f..0c478c8 100644 --- a/WEB/profil/profil.php +++ b/WEB/profil/profil.php @@ -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'])){ - Profil diff --git a/WEB/ressources/image/background.jpg b/WEB/ressources/image/background.jpg index ca3e7af..731692b 100755 Binary files a/WEB/ressources/image/background.jpg and b/WEB/ressources/image/background.jpg differ diff --git a/WEB/ressources/navbarhtml.php b/WEB/ressources/navbarhtml.php index 2b8a4b5..5340a46 100644 --- a/WEB/ressources/navbarhtml.php +++ b/WEB/ressources/navbarhtml.php @@ -1,18 +1,12 @@ - diff --git a/WEB/ressources/trajet.php b/WEB/ressources/trajet.php index 03d3aa7..4af0ed8 100644 --- a/WEB/ressources/trajet.php +++ b/WEB/ressources/trajet.php @@ -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: diff --git a/WEB/ressources/user.php b/WEB/ressources/user.php index 9285fb2..4320596 100644 --- a/WEB/ressources/user.php +++ b/WEB/ressources/user.php @@ -1,30 +1,33 @@ 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é"; - } } + ?> diff --git a/WEB/tableauBord/tableauBord.php b/WEB/tableauBord/tableauBord.php index 238e2c4..7d2af8f 100644 --- a/WEB/tableauBord/tableauBord.php +++ b/WEB/tableauBord/tableauBord.php @@ -23,7 +23,7 @@ require_once ('../ressources/verifconnecte.php');
- Déposer un trajet + Déposer un trajet Rechercher un trajet