PROJET-WEB_STRI1A/WEB/avis_laisses/avis_laisses.php

77 lines
2.6 KiB
PHP
Raw 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'];
$login = getLogin($db,$mail);
2019-05-23 17:06:08 +02:00
$requete = "SELECT DISTINCT Avis.codetrajet, Utilisateur.login, Avis.commentaire, Avis.dateavis, Avis.note FROM Utilisateur, Avis, Trajet WHERE Avis.codetrajet = Trajet.codetrajet AND Avis.mailemetteur = $1 AND Trajet.mailproposition = 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 lang = "fr">
<head>
<meta charset = "UTF-8">
<link rel = "stylesheet" href = "avis_laisses.css">
<link rel="icon" href="../ressources/favicon.ico" />
2019-05-23 08:19:11 +02:00
<link rel="stylesheet" href="../ressources/navbarhtml.css" />
2019-05-22 17:16:12 +02:00
<title>Avis Laissés</title>
</head>
<body>
2019-05-23 08:19:11 +02:00
<?php require_once ("../ressources/navbarhtml.php"); ?>
2019-05-22 17:16:12 +02:00
<div id = "container">
<div id ="entete">
2019-05-23 00:25:28 +02:00
<a href = "../tableauBord/tableauBord.php"><img id = "bouton_retour" src = "../ressources/image/return.png" alt = "Bouton retour"></a>
2019-05-22 17:16:12 +02:00
<h1 id = "titre">Avis Laissés</h1>
<br>
</div>
<div id = "avis">
<table>
2019-05-22 22:52:03 +02:00
<?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>";
}
?>
2019-05-22 17:16:12 +02:00
</tr>
</table>
</div>
</div>
</body>
</html>