Commentaire code

master
PALAFFRE Raphaël 6 years ago
parent 7c73030e97
commit bd4163c5fa

@ -1,69 +1,76 @@
<?php <?php
session_start(); //Importation des fichiers
require_once("../connexionBD.php"); session_start();
require_once("../ressources/user.php"); require_once("../connexionBD.php");
require_once("../ressources/user.php");
//Si on est pas connecté redirection vers la page de connexion
if (!isset($_SESSION['mail'])) { //Si on est pas connecté redirection vers la page de connexion
header('Location: ../index.php'); if (!isset($_SESSION['mail'])) {
exit(); header('Location: ../index.php');
} exit();
$mail = $_SESSION['mail']; }
$login = getLogin($db, $mail); //Recuperation variable session
$mail = $_SESSION['mail'];
$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)); $login = getLogin($db, $mail);
?>
<!DOCTYPE html> //Creation et envoie de la requete SQL
<html>
<head> $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;";
<meta charset="UTF-8"> $result = pg_query_params($db, $requete, array($mail));
<link rel="stylesheet" href="avis_recus.css"> ?>
<link rel="stylesheet" href="../ressources/navbarhtml.css">
<link rel="icon" href="../ressources/favicon.ico"/> <!DOCTYPE html>
<title>Avis Recus</title> <html>
</head> <head>
<body> <meta charset="UTF-8">
<?php require_once ("../ressources/navbarhtml.php"); ?> <link rel="stylesheet" href="avis_recus.css">
<div id="container"> <link rel="stylesheet" href="../ressources/navbarhtml.css">
<div id="entete"> <link rel="icon" href="../ressources/favicon.ico"/>
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour" <title>Avis Recus</title>
src="../ressources/image/return.png" </head>
alt="Bouton retour"></a> <body>
<h1 id="titre">Avis Recus</h1> <?php require_once ("../ressources/navbarhtml.php"); ?>
<br>
</div> <div id="container">
<div id="avis"> <div id="entete"> <-- Entete -->
<table> <a href="../tableauBord/tableauBord.php"><img id="bouton_retour"
<?php while ($row = pg_fetch_array($result)) { src="../ressources/image/return.png"
$nom = $row['login']; alt="Bouton retour"></a>
$date = $row['dateavis']; <h1 id="titre">Avis Recus</h1>
$commentaire = $row['commentaire']; <br>
$note = $row['note']; </div>
echo "<tr>"; <div id="avis"> <-- Avis recus -->
echo "<td class='avis_tab'>"; <table>
echo "<h3 id='nom'>$nom</h3>"; <?php while ($row = pg_fetch_array($result)) { //Stockage des valeurs de retour de la requete SQL
echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>"; $nom = $row['login'];
echo "<h5 id='avis'>$commentaire</h5>"; $date = $row['dateavis'];
echo "</td>"; $commentaire = $row['commentaire'];
echo "<td id='note_tab'>"; $note = $row['note'];
$i=0; echo "<tr>"; //Affichage des resultat sour forme de tableau
while ($i<intval($note)){ echo "<td class='avis_tab'>";
echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>"; echo "<h3 id='nom'>$nom</h3>";
$i++; echo "<h4 id='date'>".explode(' ',$date)[0]."</h4>";
} echo "<h5 id='avis'>$commentaire</h5>";
$i = $note; echo "</td>";
while ($i<3){ echo "<td id='note_tab'>";
echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>"; $i=0;
$i++; while ($i<intval($note)){ //Affichage des notes recus
} echo "<img class='etoile' src='../ressources/image/star_full.png' alt='star'>";
echo "</td>"; $i++;
} }
?> $i = $note;
</tr> while ($i<3){
</table> echo "<img class='etoile' src='../ressources/image/star.png' alt='star'>";
</div> $i++;
</div> }
</body> echo "</td>";
</html> }
?>
</tr>
</table>
</div>
</div>
</body>
</html>

Loading…
Cancel
Save