PROJET-WEB_STRI1A/WEB/avis_laisses/avis_laisses.php
2019-05-22 22:52:03 +02:00

74 lines
2.4 KiB
PHP
Executable File

<?php
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'];
$login = getLogin($db,$mail);
$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" />
<title>Avis Laissés</title>
</head>
<body>
<div id = "container">
<div id ="entete">
<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>
<?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>