PROJET-WEB_STRI1A/WEB/avis_recus/avis_recus.php
2019-05-22 17:16:12 +02:00

83 lines
3.2 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_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);
?>
<!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>
</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>
</div>
</div>
</body>
</html>