You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PROJET-WEB_STRI1A/WEB/avis_laisses/avis_laisses.php

90 lines
3.1 KiB
PHTML

<?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_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);
?>
<!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 = "../resources/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>
</tr>
</table>
</div>
</div>
</body>
</html>