PROJET-WEB_STRI1A/WEB/avis_recus/avis_recus.php

71 lines
2.7 KiB
PHP
Raw Permalink Normal View History

2019-05-22 17:16:12 +02:00
<?php
session_start();
2019-05-22 22:52:03 +02:00
require_once("../connexionBD.php");
require_once("../ressources/user.php");
2019-05-22 17:16:12 +02:00
//Si on est pas connecté redirection vers la page de connexion
if (!isset($_SESSION['mail'])) {
header('Location: ../index.php');
exit();
}
$mail = $_SESSION['mail'];
2019-05-22 22:52:03 +02:00
$login = getLogin($db, $mail);
2019-05-22 17:16:12 +02:00
2019-05-23 17:06:08 +02:00
$requete = "SELECT DISTINCT Avis.mailemetteur, Avis.codetrajet, Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.codetrajet = Trajet.codetrajet AND Trajet.mailproposition = $1 AND Avis.mailemetteur = Utilisateur.mail;";
2019-05-22 22:52:03 +02:00
$result = pg_query_params($db, $requete, array($mail));
2019-05-22 17:16:12 +02:00
?>
<!DOCTYPE html>
<html>
<head>
2019-05-22 22:52:03 +02:00
<meta charset="UTF-8">
<link rel="stylesheet" href="avis_recus.css">
<link rel="stylesheet" href="../ressources/navbarhtml.css">
<link rel="icon" href="../ressources/favicon.ico"/>
<title>Avis Recus</title>
2019-05-22 17:16:12 +02:00
</head>
<body>
2019-05-22 22:52:03 +02:00
<?php require_once ("../ressources/navbarhtml.php"); ?>
<div id="container">
<div id="entete">
<a href="../tableauBord/tableauBord.php"><img id="bouton_retour"
src="../ressources/image/return.png"
alt="Bouton retour"></a>
<h1 id="titre">Avis Recus</h1>
<br>
</div>
<div id="avis">
<table>
<?php while ($row = pg_fetch_array($result)) {
2019-05-23 17:06:08 +02:00
pg_query_params($db, "UPDATE Avis SET estlu = true WHERE mailemetteur = $1 AND codetrajet = $2;", array($row['mailemetteur'], $row['codetrajet']));
2019-05-22 22:52:03 +02:00
$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>";
2019-05-22 17:16:12 +02:00
}
?>
2019-05-22 22:52:03 +02:00
</tr>
</table>
2019-05-22 17:16:12 +02:00
</div>
2019-05-22 22:52:03 +02:00
</div>
2019-05-22 17:16:12 +02:00
</body>
</html>