SaeDEV2.2/php/event.php

96 lines
2.6 KiB
PHP
Raw Normal View History

2024-06-16 15:02:27 +02:00
<?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
2024-06-16 17:25:59 +02:00
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'];
2024-06-16 15:02:27 +02:00
echo '<h5 class="_bb1">Commentaires</h5>';
if (empty($commentaire)) {
echo '<p>Aucun</p>';
} else {
foreach ($commentaire as $com) {
echo '<section class="alert-box">';
2024-06-16 17:25:59 +02:00
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']
. '&amp;id_comment=' . $com['id_comment'] . '" login="'. $com['login']
2024-06-16 15:02:27 +02:00
. '">Modifier ce commentaire</a>' :
'')
2024-06-16 17:25:59 +02:00
. '<p class="_ts2">' . $com['contenu'] ."</p>";
//. "<p><span class='tag-box -warning'><a href=\"".$com['url']."\">".$com['login']."</a></p>";
2024-06-16 15:02:27 +02:00
echo "</section>";
}
}
echo "</div>";
2024-06-16 17:25:59 +02:00
if (empty($_SESSION['login'])) {
2024-06-16 15:02:27 +02:00
echo '<p>Il faut être identifié pour poster un commentaire.</p>';
} else {
2024-06-16 17:25:59 +02:00
echo '<p> <a href="créer_commentaire.php?id_event='. $event['id']
.'">Ajouter un commentaire</a> avec votre compte : ' . $_SESSION['login']
.' </p>';
2024-06-16 15:02:27 +02:00
}
2024-06-16 17:25:59 +02:00
?>
2024-06-16 15:02:27 +02:00
2024-06-16 17:25:59 +02:00
<p> <a href="evenement.php">Retour à la liste des evenement</a> </p>
<footer>
2024-06-16 15:02:27 +02:00
<?php
include 'footer.php';
?>
2024-06-16 17:25:59 +02:00
</footer>
2024-06-16 15:02:27 +02:00
</body>
</html>