96 lines
2.6 KiB
PHP
96 lines
2.6 KiB
PHP
<?php
|
|
require_once 'common.php';
|
|
session_start();
|
|
|
|
if (empty($_GET['id'])) {
|
|
header('Location: evenement.php');
|
|
exit();
|
|
}
|
|
|
|
|
|
$db = initDatabase();
|
|
$req = mysqli_query($db,"SELECT * FROM evenement WHERE id=" .$_GET['id']);
|
|
$event=mysqli_fetch_assoc($req);
|
|
|
|
$req = mysqli_query($db,"SELECT * FROM commentaire WHERE id_event=" . $_GET['id']);
|
|
$commentaire=mysqli_fetch_all($req,MYSQLI_ASSOC);
|
|
?>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<link rel="icon" href="../img/jo2024.jpg">
|
|
<link rel="stylesheet" href="../css/style.css">
|
|
<title>Évènements - Jeux Olympiques</title>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1 class='Hello'>Évènement</h1>
|
|
<nav>
|
|
<?php
|
|
if (isset($_SESSION['login'])) {
|
|
echo " <a href='../' class='categorie'>Page d'accueil</a>";
|
|
echo " <a href='profil.php'><img class='profil' src='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/img/photo-profil.png' alt='profil'></a>";
|
|
echo "<a href='deconnexion.php' class='categorie'>Déconnexion</a>";
|
|
}
|
|
else {
|
|
echo "<a href='../' class='categorie'>Page d'accueil</a>";
|
|
echo "<a href='connexion.php' class='categorie'>Connexion</a>";
|
|
echo "<a href='inscription.php' class='categorie'>Inscription</a>";
|
|
}
|
|
?>
|
|
</nav>
|
|
</header>
|
|
|
|
<body container>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
echo '<div id="event">'
|
|
. '<h3>'. $event['Nom'] .'</h3>'
|
|
. '<div id="content">' . $event['Description'] . '</div>';
|
|
echo "<br> Sport:". $event['Sport'];
|
|
echo "<br> Lieu:". $event['Lieux'];
|
|
echo "<br> Date:". $event['Date'];
|
|
echo "<br> Nombre de participant:". $event['NbInscrit'];
|
|
|
|
echo '<h5 class="_bb1">Commentaires</h5>';
|
|
if (empty($commentaire)) {
|
|
echo '<p>Aucun</p>';
|
|
} else {
|
|
foreach ($commentaire as $com) {
|
|
echo '<section class="alert-box">';
|
|
echo "<b class='_ts2'>".$com['login']."</b>"
|
|
. (isset($_SESSION['login']) && $com['login'] == $_SESSION['login'] ?
|
|
' <a href="créer_commentaire.php?id_event=' . $com['id_event']
|
|
. '&id_comment=' . $com['id_comment'] . '" login="'. $com['login']
|
|
. '">Modifier ce commentaire</a>' :
|
|
'')
|
|
. '<p class="_ts2">' . $com['contenu'] ."</p>";
|
|
//. "<p><span class='tag-box -warning'><a href=\"".$com['url']."\">".$com['login']."</a></p>";
|
|
echo "</section>";
|
|
}
|
|
}
|
|
echo "</div>";
|
|
|
|
if (empty($_SESSION['login'])) {
|
|
echo '<p>Il faut être identifié pour poster un commentaire.</p>';
|
|
} else {
|
|
|
|
echo '<p> <a href="créer_commentaire.php?id_event='. $event['id']
|
|
.'">Ajouter un commentaire</a> avec votre compte : ' . $_SESSION['login']
|
|
.' </p>';
|
|
}
|
|
|
|
?>
|
|
|
|
<p> <a href="evenement.php">Retour à la liste des evenement</a> </p>
|
|
<footer>
|
|
<?php
|
|
include 'footer.php';
|
|
?>
|
|
</footer>
|
|
</body>
|
|
</html>
|