From dc4ab633a14c12f3211bda7469f325a66e489145 Mon Sep 17 00:00:00 2001 From: Loris BALOCCHI Date: Sun, 16 Jun 2024 01:22:30 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20fonctionnalit=C3=A9=20de=20vu?= =?UTF-8?q?e=20de=20tous=20les=20=C3=A9v=C3=A8nements.=20Ajout=20de=20la?= =?UTF-8?q?=20r=C3=A9servation=20d'un=20=C3=A9v=C3=A8nement.=20Fix=20incom?= =?UTF-8?q?plet=20de=20la=20modification=20d'un=20utilisateur.=20CSS.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Charpentier Juliette - - - + + + + + + + + + + + + + + + + + + Jeux Olympiques - Paris 2024 + + + + Vous n'êtes pas autorisé à accéder à cette page.

"; + echo "

Redirection vers l'accueil dans 5 secondes...

"; + header("refresh:5; url=/"); + include $_SERVER['DOCUMENT_ROOT'] . '/views/footer.php'; + die(); + } ?> +

Mes réservations

+ Bienvenue " . $name . " " . $familyName . ".

"; + + ?> + + ✅ Votre réservation a bien été prise en compte.

"; + } else if ($_GET['res'] == "booking-failed") { + echo "

❌ La réservation a échoué. Veuillez réessayer.

"; + } else if ($_GET['res'] == "cancellation-failed") { + echo "

❌ L'annulation a échoué. Veuillez réessayer.

"; + } else if ($_GET['res'] == "cancellation-succeeded") { + $eventTitleFetched = $_GET['eventtitle']; + echo "

✅ L'annulation de $eventTitleFetched a bien été prise en compte.

"; + } + } + //afficher la liste des évènements auxquels l'utilisateur est inscrit (avec mysqli) (table booking) + $stmt = mysqli_prepare($db, "SELECT * FROM booking WHERE mail = ?"); + mysqli_stmt_bind_param($stmt, "s", $email); + mysqli_stmt_execute($stmt); + $result = mysqli_stmt_get_result($stmt); + if (mysqli_num_rows($result) == 0) { + echo "

Vous n'êtes inscrit à aucun évènement pour le moment.

"; + } else { + echo "

Voici la liste des évènements auxquels vous êtes inscrit :

"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + ; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + // sélectionner les évènements auxquels l'utilisateur est inscrit (avec mysqli et à l'aide de $email) (utiliser cette requete ? SELECT * FROM booking WHERE mail="$email";) + while ($booking = mysqli_fetch_assoc($result)) { + $eventID = $booking['id']; + $stmt = mysqli_prepare($db, "SELECT * FROM event WHERE id = ?"); + mysqli_stmt_bind_param($stmt, "i", $eventID); + mysqli_stmt_execute($stmt); + $eventResult = mysqli_stmt_get_result($stmt); + $event = mysqli_fetch_assoc($eventResult); + + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + echo "
Nom de l'évènementDateLieuAction
" . $event['title'] . "" . date('d/m/Y', strtotime($event['date'])) . "" . $event['location'] . "Annuler
"; + } + + //echo "Annuler"; + + ?> + + + + + \ No newline at end of file diff --git a/account/register/index.php b/account/register/index.php index 51a72ee..4857fb2 100644 --- a/account/register/index.php +++ b/account/register/index.php @@ -17,22 +17,15 @@ if (isset($_COOKIE['userData'])) { - - - + + + Nouveau compte | Jeux Olympiques - Paris 2024 - + diff --git a/admin/users/add/add.php b/admin/users/add/add.php index d0d3f52..d8393b2 100644 --- a/admin/users/add/add.php +++ b/admin/users/add/add.php @@ -16,14 +16,18 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $userName = htmlspecialchars($_POST["name"]); $userFamilyName = htmlspecialchars($_POST["family_name"]); $userEmail = htmlspecialchars($_POST["email"]); - $usePassword = htmlspecialchars($_POST["password"]); + $userPassword = htmlspecialchars($_POST["password"]); $userUserRole = htmlspecialchars($_POST["role"]); + $hashedPassword = sha1($userPassword); } -$hashedPassword = sha1($userPassword); -$query = "SELECT mail FROM user WHERE mail = '$userEmail'"; -$result = mysqli_query($db, $query); + +$query = "SELECT mail FROM user WHERE mail = ?"; +$stmt = mysqli_prepare($db, $query); +mysqli_stmt_bind_param($stmt, "s", $userEmail); +mysqli_stmt_execute($stmt); +$result = mysqli_stmt_get_result($stmt); if (!$result) { die("Erreur lors de l'exécution de la requête."); @@ -32,30 +36,31 @@ if (!$result) { $row = mysqli_fetch_assoc($result); if ($row) { - die("

Un utilisateur avec cette adresse mail existe déjà.

"); -} + $addUser = "INSERT INTO `user`(`mail`, `name`, `family_name`, `role`, `password`) VALUES (?, ?, ?, ?, ?)"; + $stmtAddUser = mysqli_prepare($db, $addUser); + mysqli_stmt_bind_param($stmtAddUser, "sssss", $userEmail, $userName, $userFamilyName, $userUserRole, $hashedPassword); + $resultAddUser = mysqli_stmt_execute($stmtAddUser); + $addUser = "INSERT INTO `user`(`mail`, `name`, `family_name`, `role`, `password`) VALUES ('$userEmail', '$userName', '$userFamilyName', '$userUserRole', '$hashedPassword')"; -$addUser = "INSERT INTO `user`(`mail`, `name`, `family_name`, `role`, `password`) VALUES ('$userEmail', '$userName', '$userFamilyName', '$userUserRole', '$hashedPassword')"; - -$resultAddUser = mysqli_query($db, $addUser); -if (!$resultAddUser) { - echo "

Erreur lors de l'exécution de la requête.

"; -} else { - if (mysqli_affected_rows($db) > 0) { - echo "

Utilisateur créé avec succès.

"; - - echo "

Prénom : " . $userName . "

"; - echo "

Nom : " . $userFamilyName . "

"; - echo "

Adresse mail : " . $userEmail . "

"; - echo "

Mot de passe : " . $userPassword . "

"; - echo "

Mot de passe hashé : " . $hashedPassword . "

"; - echo "

Rôle : " . $userUserRole . "

"; - include ($_SERVER['DOCUMENT_ROOT'] . '/tools/discordWebhookRegister.php'); - header("Location: /admin/users/?newuser=$userEmail"); - die(); + $resultAddUser = mysqli_query($db, $addUser); + if (!$resultAddUser) { + echo "

Erreur lors de l'exécution de la requête.

"; } else { - echo "

Aucun utilisateur n\'a été ajouté.

"; + if (mysqli_affected_rows($db) > 0) { + echo "

Utilisateur créé avec succès.

"; + + echo "

Prénom : " . $userName . "

"; + echo "

Nom : " . $userFamilyName . "

"; + echo "

Adresse mail : " . $userEmail . "

"; + echo "

Mot de passe : " . $userPassword . "

"; + echo "

Mot de passe hashé : " . $hashedPassword . "

"; + echo "

Rôle : " . $userUserRole . "

"; + include ($_SERVER['DOCUMENT_ROOT'] . '/tools/discordWebhookRegister.php'); + header("Location: /admin/users/?newuser=$userEmail"); + die(); + } else { + echo "

Aucun utilisateur n\'a été ajouté.

"; + } } } - ?> \ No newline at end of file diff --git a/admin/users/edit/edit.php b/admin/users/edit/edit.php new file mode 100644 index 0000000..ae0f889 --- /dev/null +++ b/admin/users/edit/edit.php @@ -0,0 +1,60 @@ +Un utilisateur avec cette adresse mail existe déjà.

"); + } +} + +if (!$result) { + die("Erreur lors de l'exécution de la requête."); +} + +$editUser = "UPDATE `user` SET `mail`='$userEmail', `name`='$userName', `family_name`='$userFamilyName', `role`='$userUserRole' WHERE `mail`='$userEmail'"; + +$resultEditUser = mysqli_query($db, $editUser); +if (!$resultEditUser) { + echo "

Erreur lors de l'exécution de la requête.

"; +} else { + if (mysqli_affected_rows($db) > 0) { + echo "

Utilisateur créé avec succès.

"; + + echo "

Prénom : " . $userName . "

"; + echo "

Nom : " . $userFamilyName . "

"; + echo "

Adresse mail : " . $userEmail . "

"; + echo "

Mot de passe : " . $userPassword . "

"; + echo "

Mot de passe hashé : " . $hashedPassword . "

"; + echo "

Rôle : " . $userUserRole . "

"; + include ($_SERVER['DOCUMENT_ROOT'] . '/tools/discordWebhookRegister.php'); + header("Location: /admin/users/edit?usermail=$userEmail"); + die(); + } else { + echo "

Aucun utilisateur n\'a été ajouté.

"; + } +} + +?> \ No newline at end of file diff --git a/admin/users/edit/index.php b/admin/users/edit/index.php index 13be7ef..b3bf848 100644 --- a/admin/users/edit/index.php +++ b/admin/users/edit/index.php @@ -2,8 +2,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php'; session_start(); -if (isset($_COOKIE['userData'])) { - $userDataEncoded = $_COOKIE['userData']; +$userDataEncoded = isset($_COOKIE['userData']) ? $_COOKIE['userData'] : null; +if ($userDataEncoded) { $userData = json_decode($userDataEncoded, true); // 'true' pour obtenir un tableau associatif $email = $userData['email']; @@ -11,6 +11,30 @@ if (isset($_COOKIE['userData'])) { $familyName = $userData['familyName']; $role = $userData['role']; } +//faire le nécessaire epour récup le mail donné en valriable dans l'url dans $userEmail +// requete préparée sql pour obtenir les infos de l'utilisateur à partir du mail +// tu auras des variuables qui contiendront les informations de l'utilisateur, tu n'as plus qu'à +// les afficher correctement dans les cases. Laisse son role d'affiché, mais mets juste en dessous un +// menu déroulant avec tous les 4 rôles possibles + + +if (isset($_GET['usermail'])) { + $userEmail = $_GET['usermail']; + $stmt = mysqli_prepare($db, "SELECT * FROM user WHERE mail = ?"); + mysqli_stmt_bind_param($stmt, "s", $userEmail); + mysqli_stmt_execute($stmt); + $result = mysqli_stmt_get_result($stmt); + while ($row = mysqli_fetch_assoc($result)) { + $userEmail = $row["mail"]; + $userFirstName = $row["name"]; + $userFamilyName = $row["family_name"]; + $userRole = $row["role"]; + } + +} else { + echo "

Vous n'avez pas renseigné d'utilisateur à modifier.

"; +} + ?> @@ -19,28 +43,71 @@ if (isset($_COOKIE['userData'])) { - - - + + + - Titre de la page | Jeux Olympiques - Paris 2024 + + + Profil de l'utilisateur| Jeux Olympiques - Paris 2024 - = - + +

Profil de l'utilisateur :

- + Avatar +

Mettre à jour ces informations

+

Modifiez les informations de ce profil.

+ Vous modifiez actuellement le profil de l'utilisateur $userEmail.

"; + echo "

Ce profil est actuellement de type $userRole.

"; + echo "

" . $userFirstName . " " . $userFamilyName . "

"; + echo "

" . $userEmail . "

"; - } + ?> - ?> +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + + +
+
+ + diff --git a/admin/users/index.php b/admin/users/index.php index b2d5a27..07b278c 100644 --- a/admin/users/index.php +++ b/admin/users/index.php @@ -82,7 +82,7 @@ if (isset($_COOKIE['userData'])) { echo "" . $row['name'] . ""; echo "" . $row['family_name'] . ""; echo "" . $row['role'] . ""; - echo "Modifier | Supprimer"; + echo "Modifier | Supprimer"; echo ""; } echo ""; diff --git a/events/book/book.php b/events/book/book.php index c92a807..71d240e 100644 --- a/events/book/book.php +++ b/events/book/book.php @@ -3,8 +3,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php'; session_start(); if (isset($_COOKIE['userData'])) { - $userDataEncoded = $_COOKIE['userData']; - $userData = json_decode($userDataEncoded, true); // 'true' pour obtenir un tableau associatif + $userData = json_decode($_COOKIE['userData'], true); $email = $userData['email']; $name = $userData['name']; @@ -12,12 +11,51 @@ if (isset($_COOKIE['userData'])) { $role = $userData['role']; } -// un utilisateur a cliqué sur le bouton "S'inscrire" d'un évènement - - +if (isset($_GET['usermail']) && isset($_GET['event'])) { + $userEmail = $_GET['usermail']; + $eventId = $_GET['event']; + $stmt = mysqli_prepare($db, "SELECT * FROM event WHERE id = ?"); + mysqli_stmt_bind_param($stmt, "i", $eventId); + mysqli_stmt_execute($stmt); + $result = mysqli_stmt_get_result($stmt); + $eventDetails = mysqli_fetch_assoc($result); + if ($eventDetails) { + $eventTitle = $eventDetails["title"]; + $eventDescription = $eventDetails["description"]; + $eventType = $eventDetails["event_type"]; + $eventDate = $eventDetails["date"]; + $eventLocation = $eventDetails["location"]; + echo "

Vous vous apprêtez à vous inscrire à l'évènement suivant :

"; + echo "

Nom de l'évènement : $eventTitle

"; + echo "

Date de l'évènement : $eventDate

"; + echo "

Lieu de l'évènement : $eventLocation

"; + echo "

Discipline de l'évènement : $eventType

"; + echo "

Description de l'évènement : $eventDescription

"; + echo "

Adresse mail de l'utilisateur : $userEmail

"; + $stmt = mysqli_prepare($db, "INSERT INTO booking (id, mail, title, description, event_type, date, location) VALUES (?, ?, ?, ?, ?, ?, ?)"); + mysqli_stmt_bind_param($stmt, "issssss", $eventId, $userEmail, $eventTitle, $eventDescription, $eventType, $eventDate, $eventLocation); + if (mysqli_stmt_execute($stmt)) { + echo "

Votre inscription à l'évènement $eventTitle a bien été prise en compte.

"; + $stmt = mysqli_prepare($db, "UPDATE event SET guest_count = guest_count + 1 WHERE id = ?"); + mysqli_stmt_bind_param($stmt, "i", $eventId); + if (mysqli_stmt_execute($stmt)) { + echo "

Le nombre de participants a été mis à jour.

"; + include $_SERVER['DOCUMENT_ROOT'] . '/tools/discordWebhookBooking.php'; + header("Location: /account/profile/myevents?res=booking-succeeded"); + } else { + echo "

Erreur lors de la mise à jour du nombre de participants.

"; + } + } else { + echo "

Une erreur est survenue lors de votre inscription à l'évènement. Erreur : " . mysqli_error($db) . "

"; + header("Location: /account/profile/myevents?res=booking-failed"); + } + } else { + echo "

Évènement introuvable.

"; + } +} ?> \ No newline at end of file diff --git a/events/book/cancel.php b/events/book/cancel.php new file mode 100644 index 0000000..60136b4 --- /dev/null +++ b/events/book/cancel.php @@ -0,0 +1,61 @@ +Vous vous apprêtez à annuler votre inscription à l'évènement suivant :

"; + echo "

Nom de l'évènement : $eventTitle

"; + echo "

Date de l'évènement : $eventDate

"; + echo "

Lieu de l'évènement : $eventLocation

"; + echo "

Discipline de l'évènement : $eventType

"; + echo "

Description de l'évènement : $eventDescription

"; + echo "

Adresse mail de l'utilisateur : $userEmail

"; + + $stmt = mysqli_prepare($db, "DELETE FROM booking WHERE id = ? AND mail = ?"); + mysqli_stmt_bind_param($stmt, "is", $eventId, $userEmail); + if (mysqli_stmt_execute($stmt)) { + + + echo "

Votre annulation à l'évènement $eventTitle a bien été prise en compte.

"; + + $stmt = mysqli_prepare($db, "UPDATE event SET guest_count = guest_count - 1 WHERE id = ?"); + mysqli_stmt_bind_param($stmt, "i", $eventId); + if (mysqli_stmt_execute($stmt)) { + echo "

Le nombre de participants a été mis à jour.

"; + include $_SERVER['DOCUMENT_ROOT'] . '/tools/discordWebhookBooking.php'; + header("Location: /account/profile/myevents?res=cancellation-succeeded&eventtitle=$eventTitle"); + } else { + echo "

Erreur lors de la mise à jour du nombre de participants.

"; + } + } else { + echo "

Une erreur est survenue lors de votre annulation à l'évènement. Erreur : " . mysqli_error($db) . "

"; + header("Location: /account/profile/myevents?res=cancellation-failed"); + } + } +} +?> \ No newline at end of file diff --git a/events/index.php b/events/index.php index ef1db34..8e621a9 100644 --- a/events/index.php +++ b/events/index.php @@ -34,33 +34,101 @@ ?> Créer un évènement'; - echo ''; + echo ''; } else if ($role == 'Sportif') { echo ''; - echo ''; + echo ''; + echo ''; + } else { - echo ''; + echo ''; } - echo ''; + echo ''; } else { - echo ''; + echo ''; } + // faire une requete sql avec mysqli permettant d'afficher tous les évènements + // afficher les évènements sous forme de tableau + // voici les colonnes disponibles dans la table event + // id title description event_type date location role guest_count creator + + + $query = "SELECT * FROM event"; + + if (isset($_GET['sort'])) { + $sort = $_GET['sort']; + switch ($sort) { + case 'date': + $query .= " ORDER BY date"; + break; + case 'location': + $query .= " ORDER BY location"; + break; + case 'discipline': + $query .= " ORDER BY event_type"; + break; + default: + break; + } + } + + // Menu déroulant pour sélectionner le tri + echo "
"; + echo ""; + echo ""; + echo "
"; + $result = mysqli_query($db, $query); + echo "
"; + echo "
"; + echo ""; + echo ""; // En-tête du tableau + echo ""; + echo ""; // Ensure class name matches with the CSS + echo ""; // Ensure class name matches with the CSS + echo ""; // Ensure class name matches with the CSS + echo ""; // Ensure class name matches with the CSS + echo ""; // Ensure class name matches with the CSS + echo ""; + echo ""; + echo ""; // The scrollable body class removed here if not necessary + while ($row = mysqli_fetch_array($result)) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + echo ""; + echo "
TitreDescriptionDisciplineDateLieu
" . htmlspecialchars($row['title']) . "" . htmlspecialchars($row['description']) . "" . htmlspecialchars($row['event_type']) . "" . htmlspecialchars($row['date']) . "" . htmlspecialchars($row['location']) . "
"; + echo "
"; + echo "
"; + + ?> diff --git a/events/list/display/index.php b/events/list/display/index.php index 2835bbe..f79a010 100644 --- a/events/list/display/index.php +++ b/events/list/display/index.php @@ -37,19 +37,24 @@ if (isset($_COOKIE['userData'])) { Évènements à $location"; - $query = "SELECT * FROM event WHERE location = '$location'"; + $location = $_GET['location']; + echo "

Évènements à $location pour les $role" . "s" . "

"; + if ($role == 'Administrateur') { + $query = "SELECT * FROM event WHERE location = '$location'"; + } else { + $query = "SELECT * FROM event WHERE location = '$location' AND role LIKE '%$role%'"; + } $result = mysqli_query($db, $query); echo "
"; if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { + $eventID = htmlspecialchars($row['id'], ENT_QUOTES); $title = htmlspecialchars($row['title'], ENT_QUOTES, 'UTF-8'); $description = htmlspecialchars($row['description'], ENT_QUOTES); $event_type = htmlspecialchars($row['event_type'], ENT_QUOTES); $date = date('d/m/Y', strtotime(htmlspecialchars($row['date']))); $location = htmlspecialchars($row['location'], ENT_QUOTES); - $role = htmlspecialchars($row['role'], ENT_QUOTES); + $authorized_roles = htmlspecialchars($row['role'], ENT_QUOTES); $guest_count = htmlspecialchars($row['guest_count'], ENT_QUOTES); $creator = htmlspecialchars($row['creator'], ENT_QUOTES); echo "
"; @@ -58,33 +63,44 @@ if (isset($_COOKIE['userData'])) { echo "

Date : $date

"; echo "

Lieu : $location

"; echo "

Nombre de participants : $guest_count

"; - echo "

(Roles autorisés) : $role

"; + echo "

(Roles autorisés) : $authorized_roles

"; echo "

$description

"; - + if ($role != 'Administrateur') { + if ($role != 'Administrateur') { + echo ""; + } + } + if ($role == 'Sportif') { + echo ""; + } echo "
"; - } } else { - echo "

Aucun évènement trouvé à $location

"; + echo "

Aucun évènement trouvé à cet endroit.

"; + echo "
"; } - echo ""; } + if (isset($_GET['date'])) { - $date = htmlspecialchars($_GET['date']); - $date_fr = date('d/m/Y', strtotime($date)); - echo "

Évènements le $date_fr

"; - $query = "SELECT * FROM event WHERE date = '$date'"; + $date = $_GET['date']; + echo "

Évènements le $date pour $role

"; + if ($role == 'Administrateur') { + $query = "SELECT * FROM event WHERE date = '$date'"; + } else { + $query = "SELECT * FROM event WHERE date = '$date' AND role LIKE '%$role%'"; + } $result = mysqli_query($db, $query); echo "
"; if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { + $eventID = htmlspecialchars($row['id'], ENT_QUOTES); $title = htmlspecialchars($row['title'], ENT_QUOTES); $description = htmlspecialchars($row['description'], ENT_QUOTES); $event_type = htmlspecialchars($row['event_type'], ENT_QUOTES); $date = date('d/m/Y', strtotime(htmlspecialchars($row['date']))); $location = htmlspecialchars($row['location'], ENT_QUOTES); - $role = htmlspecialchars($row['role'], ENT_QUOTES); + $authorized_roles = htmlspecialchars($row['role'], ENT_QUOTES); $guest_count = htmlspecialchars($row['guest_count'], ENT_QUOTES); $creator = htmlspecialchars($row['creator'], ENT_QUOTES); echo "
"; @@ -93,31 +109,42 @@ if (isset($_COOKIE['userData'])) { echo "

Date : $date

"; echo "

Lieu : $location

"; echo "

Nombre de participants : $guest_count

"; - echo "

(Roles autorisés) : $role

"; + echo "

(Roles autorisés) : $authorized_roles

"; echo "

$description

"; + if ($role != 'Administrateur') { + echo ""; + } + if ($role == 'Sportif') { + echo ""; + } echo "
"; } } else { - echo "

Aucun évènement trouvé le" . $date_fr . ".

"; + echo "

Aucun évènement trouvé à la date recherchée.

"; } echo "
"; } if (isset($_GET['title'])) { - $title = htmlspecialchars($_GET['title']); - echo "

Évènement intitulé " . $title . "

"; - $query = "SELECT * FROM event WHERE title = '$title'"; + $title = $_GET['title']; + echo "

Évènement intitulé \"$title\"

"; + if ($role == 'Administrateur') { + $query = "SELECT * FROM event WHERE title = '$title'"; + } else { + $query = "SELECT * FROM event WHERE title = '$title' AND role LIKE '%$role%'"; + } $result = mysqli_query($db, $query); echo "
"; if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { + $eventID = htmlspecialchars($row['id'], ENT_QUOTES); $title = htmlspecialchars($row['title'], ENT_QUOTES); $description = htmlspecialchars($row['description'], ENT_QUOTES); $event_type = htmlspecialchars($row['event_type'], ENT_QUOTES); $date = date('d/m/Y', strtotime(htmlspecialchars($row['date']))); $location = htmlspecialchars($row['location'], ENT_QUOTES); - $role = htmlspecialchars($row['role'], ENT_QUOTES); + $authorized_roles = htmlspecialchars($row['role'], ENT_QUOTES); $guest_count = htmlspecialchars($row['guest_count'], ENT_QUOTES); $creator = htmlspecialchars($row['creator'], ENT_QUOTES); echo "
"; @@ -126,9 +153,14 @@ if (isset($_COOKIE['userData'])) { echo "

Date : $date

"; echo "

Lieu : $location

"; echo "

Nombre de participants : $guest_count

"; - echo "

(Roles autorisés) : $role

"; + echo "

(Roles autorisés) : $authorized_roles

"; echo "

$description

"; - echo ""; // Add the button here + if ($role != 'Administrateur') { + echo ""; + } + if ($role == 'Sportif') { + echo ""; + } echo "
"; } } else { diff --git a/styles/main.css b/styles/main.css index a257700..eaad6b1 100644 --- a/styles/main.css +++ b/styles/main.css @@ -465,3 +465,87 @@ button.new-event:hover { font-family: "RobotoFlex"; color: #8e8c8c; } + +.events-flex-container { + background: #26272b; /* Dark background for contrast */ + padding: 3rem; + border-radius: 10px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5); + width: 75%; + margin: 2rem auto; /* Center the element horizontally */ + color: #ffffff; /* Ensure text is readable on dark background */ + overflow: hidden; /* Ensures no spillover from the inner table */ +} + +.event-table { + width: 100%; /* Full width of its container */ + border-collapse: collapse; /* Collapse borders */ + table-layout: fixed; /* Fixed layout for consistent column sizing */ + + font-size: 0.9em; + min-width: 400px; +} + +.event-table thead th { + background-color: #34353a; /* Dark background for contrast */ + color: #ffffff; + text-align: left; + font-weight: bold; + position: sticky; + z-index: 2; + top: 0; +} + +.event-table th, +.event-table td { + padding: 12px 15px; +} + +.event-table tbody tr { + border-bottom: 1px solid #dddddd; +} + +.event-table tbody tr:nth-of-type(even) { + background-color: #242427; /* Dark background for contrast */ +} + +.event-table tbody tr:last-of-type { + border-bottom: 2px solid #26272b; /* Dark background for contrast */ +} + +.scrollable { + height: 600px; + overflow-y: scroll; + border-bottom: 1px solid #ddd; +} + +.order-by { + margin-bottom: 1rem; + text-align: center; + width: 100%; + margin-left: auto; + margin-right: auto; +} +.order-by label { + display: block; + margin-bottom: 0.5rem; + color: #b1aeae; + padding-right: 11%; +} + +.order-by select { + width: 15%; + padding: 0.5rem; + border: 1px solid #121216; + border-radius: 5px; + background-color: #34353a; + color: #fffe; + transition: all 0.3s ease; + appearance: none; /* Pour supprimer le style par défaut */ + -webkit-appearance: none; /* Pour Safari */ + -moz-appearance: none; /* Pour Firefox */ + background-image: url("https://cdn-icons-png.flaticon.com/16/8442/8442683.png"); /* Ajoutez votre icône personnalisée */ + background-repeat: no-repeat; + background-position: right 0.5rem center; /* Ajustez selon la taille de votre padding */ + background-size: 1.5rem; /* Ajustez selon la taille souhaitée pour l'icône */ +} diff --git a/tools/discordWebhookBooking.php b/tools/discordWebhookBooking.php new file mode 100644 index 0000000..46f333e --- /dev/null +++ b/tools/discordWebhookBooking.php @@ -0,0 +1,108 @@ + "## ✅ Nouvelle réservation à un évènement ! \n@here", + "username" => "Jeux Olympiques - Paris 2024", + "avatar_url" => "https://i.imgur.com/gg5xPa1.png", + "tts" => false, + "embeds" => [ + [ + "title" => "Jeux Olympiques - Paris 2024", + "type" => "rich", + "description" => "", + "url" => "https://but.lbalocchi.fr/", + "timestamp" => date('c', time()), + "color" => hexdec("F4B400"), + "footer" => [ + "text" => "© Juliette & Loris - 2024", + "icon_url" => "https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" + ], + "image" => [ + "url" => "https://www.fromagersdefrance.com/wp-content/uploads/2023/03/1200px-Logo_JO_dete_-_Paris_2024.svg__0.png" + ], + "author" => [ + "name" => "Juliette & Loris", + "url" => "https://stackoverflow.com/a/51748785", + ], + + // Field array of objects + "fields" => [ + [ + "name" => "Nom", + "value" => $name, + "inline" => true + ], + [ + "name" => "Prénom", + "value" => $familyName, + "inline" => true + ], + [ + "name" => "Email", + "value" => $email, + "inline" => true + ], + [ + "name" => "Rôle", + "value" => $role, + "inline" => true + ], + [ + "name" => "Évènement", + "value" => $eventTitle, + "inline" => true + ], + [ + "name" => "Date", + "value" => $eventDate, + "inline" => true + ], + [ + "name" => "Lieu", + "value" => $eventLocation, + "inline" => true + ], + [ + "name" => "Type", + "value" => $eventType, + "inline" => true + ], + [ + "name" => "Description", + "value" => $eventDescription, + "inline" => true + ] + + ] + ] + ] + +], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); +$ch = curl_init(); +curl_setopt_array($ch, [ + CURLOPT_URL => $url, + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => $hookObject, + CURLOPT_HTTPHEADER => [ + "Content-Type: application/json" + ] +]); +$response = curl_exec($ch); +curl_close($ch); +?> \ No newline at end of file diff --git a/views/footer.php b/views/footer.php index 8cf8ebd..57c17af 100644 --- a/views/footer.php +++ b/views/footer.php @@ -36,6 +36,14 @@ if (isset($_COOKIE['userData'])) { } ?>
  • Évènements
  • + Mes réservations"; + } + } + ?>
    diff --git a/views/header.php b/views/header.php index 344f58a..a7b2cd7 100644 --- a/views/header.php +++ b/views/header.php @@ -79,6 +79,14 @@ if (isset($_COOKIE['userData'])) { ?> + Mes réservations"; + } + } + ?>