Ajout de webhooks pour le login/register/newEvent.
Ajout des pages pour gestion globale des évènements. Co-authored-by: Charpentier Juliette <juliette.charpentier@etu.u-pec.fr>
This commit is contained in:
parent
7c326d3908
commit
9adca94b82
2
.gitignore
vendored
2
.gitignore
vendored
@ -112,3 +112,5 @@ tags
|
||||
# Persistent undo
|
||||
[._]*.un~
|
||||
|
||||
|
||||
.mdj
|
@ -36,7 +36,7 @@ if (isset($_COOKIE['userData'])) {
|
||||
<img src="https://cdn-icons-png.flaticon.com/512/4139/4139948.png" alt="Avatar">
|
||||
<h2 class="login-title">Connexion à votre compte</h2>
|
||||
<p class="login-subtitle">Connectez-vous afin d'accéder à l'entièreté du site.</p>
|
||||
<form action="/account/login/login.php" method="post">
|
||||
<form class="form" action="/account/login/login.php" method="post">
|
||||
<div class="form-group">
|
||||
<label for="email">Adresse mail</label>
|
||||
<input type="email" id="email" name="email" placeholder="username@example.com" required placeholder=" ">
|
||||
@ -45,9 +45,13 @@ if (isset($_COOKIE['userData'])) {
|
||||
<label for="password">Mot de passe</label>
|
||||
<input type="password" id="password" name="password" required placeholder="••••••••" placeholder=" ">
|
||||
</div>
|
||||
|
||||
<div class="form-group forgot-password">
|
||||
</div>
|
||||
<?php
|
||||
if (isset($_GET['res'])) {
|
||||
if ($_GET['res'] == "login-failed") {
|
||||
echo "<p class='text' style='color:red; padding-left:0; padding-right:0; width:fit-content;'>⛔ Adresse mail ou mot de passe incorrect.</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<button type="submit" class="submit-button"><i class="fas fa-sign-in-alt"></i>
|
||||
Connexion</i></button>
|
||||
</form>
|
||||
|
@ -1,42 +1,26 @@
|
||||
<?php
|
||||
require_once ($_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php');
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$email = htmlspecialchars($_POST["email"]);
|
||||
$password = htmlspecialchars($_POST["password"]);
|
||||
}
|
||||
|
||||
/*
|
||||
hasher le mdp
|
||||
- check la validité du combo mail + mdp (qui es thashé sur la bdd)
|
||||
- si valide, on enregistre un cookie avec mail, nom, prénom, rôle (requete sql pour les obtenir)
|
||||
- créer un cookie avec mail, nom, prénom, rôle. Qui expire dans 1h
|
||||
une fois bien connecté, on redirige vers /account/profile
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
if (isset($_COOKIE['userData'])) {
|
||||
header("Location: /account/profile");
|
||||
}
|
||||
$hashedPassword = sha1($password);
|
||||
$resultat = mysqli_query($db, "SELECT *
|
||||
FROM user
|
||||
WHERE mail = '$email' AND password = '$hashedPassword'");
|
||||
$stmt = mysqli_prepare($db, "SELECT * FROM user WHERE mail = ? AND password = ?");
|
||||
mysqli_stmt_bind_param($stmt, 'ss', $email, $hashedPassword);
|
||||
$result = mysqli_stmt_execute($stmt);
|
||||
$result = $stmt->get_result();
|
||||
|
||||
$query = "SELECT mail, password
|
||||
FROM user
|
||||
WHERE mail = '$email'";
|
||||
$result = mysqli_query($db, $query);
|
||||
|
||||
if (!$result) {
|
||||
die("Erreur lors de l'exécution de la requête.");
|
||||
}
|
||||
|
||||
if (!$password) {
|
||||
die("Combinaison email/mot de passe incorrecte.");
|
||||
}
|
||||
if (!$email) {
|
||||
die("Combinaison email/mot de passe incorrecte.");
|
||||
die('Erreur de requête : ' . mysqli_error($db));
|
||||
} else {
|
||||
if (mysqli_num_rows($result) == 0) {
|
||||
header("Location: /account/login?res=login-failed");
|
||||
die();
|
||||
} else {
|
||||
echo "<p>Connexion réussie</p>";
|
||||
|
||||
// Requête pour récupérer les informations de l'utilisateur
|
||||
$query = "SELECT name, family_name, role FROM user WHERE mail = '$email'";
|
||||
$result = mysqli_query($db, $query);
|
||||
@ -53,41 +37,23 @@ if (!$email) {
|
||||
} else {
|
||||
echo "Aucun utilisateur trouvé avec cet email.";
|
||||
}
|
||||
|
||||
|
||||
// Mise en forme dans un format .JSON et création du cookie.
|
||||
$userData = array(
|
||||
"email" => $email,
|
||||
"name" => $nameFetched,
|
||||
"familyName" => $familyNameFetched,
|
||||
"role" => $roleFetched
|
||||
);
|
||||
|
||||
$userDataEncoded = json_encode($userData);
|
||||
|
||||
setcookie("userData", $userDataEncoded, time() + 3600, "/");
|
||||
|
||||
// Utilistation d'un Webhook Discord pour notifier l'administrateur de la
|
||||
//connexion des utilisateurs [fork de : https://stackoverflow.com/a/73547248]
|
||||
|
||||
if (isset($_COOKIE['userData'])) {
|
||||
$userDataEncoded = $_COOKIE['userData'];
|
||||
$userData = json_decode($userDataEncoded, true); // 'true' pour obtenir un tableau associatif
|
||||
include ($_SERVER['DOCUMENT_ROOT'] . '/views/discordWebhookLogin.php');
|
||||
|
||||
echo "Email : " . $userData['email'] . "<br>";
|
||||
echo "Prénom : " . $userData['name'] . "<br>";
|
||||
echo "Nom : " . $userData['familyName'] . "<br>";
|
||||
echo "Rôle : " . $userData['role'] . "<br>";
|
||||
} else {
|
||||
echo "Cookie 'userData' non trouvé.";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$newURL = "/";
|
||||
header("Location: " . $newURL);
|
||||
header("Location: /?res=login-succeeded");
|
||||
die();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
@ -9,29 +9,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
|
||||
- enregistrer le nouvel utilisateur dans la bdd
|
||||
- créer un cookie avec mail, nom, prénom, rôle. Qui expire dans 1h
|
||||
*/
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="../../styles/main.css" />
|
||||
<link rel="stylesheet" href="../../styles/header.css" />
|
||||
<link rel="stylesheet" href="../../styles/footer.css" />
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32"
|
||||
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
|
||||
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|
||||
<title>Jeux Olympiques - Paris 2024</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php');
|
||||
include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php');
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$name = htmlspecialchars($_POST["name"]);
|
||||
@ -62,10 +40,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
|
||||
$role = "Sportif";
|
||||
} else if ($codeRole == "VJC6V") {
|
||||
$role = "Organisateur";
|
||||
} else if ($codeRole == "XJ9LQ") {
|
||||
$role = "Spectateur";
|
||||
} else {
|
||||
$role = "Membre";
|
||||
$role = "Spectateur";
|
||||
}
|
||||
|
||||
$addUser = "INSERT INTO `user`(`mail`, `name`, `family_name`, `role`, `password`) VALUES ('$email', '$name', '$familyName', '$role', '$hashedPassword')";
|
||||
@ -98,10 +74,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
|
||||
echo "<p class='text'>Mot de passe : " . $password . "</p>";
|
||||
echo "<p class='text'>Mot de passe hashé : " . $hashedPassword . "</p>";
|
||||
echo "<p class='text'>Rôle : " . $role . "</p>";
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
window.location.href = '/';
|
||||
</script> <?php
|
||||
include ($_SERVER['DOCUMENT_ROOT'] . '/views/discordWebhookRegister.php');
|
||||
header("Location: /?res=login-succeeded");
|
||||
die();
|
||||
} else {
|
||||
echo "<p class='text'>Aucun utilisateur n\'a été ajouté.</p>";
|
||||
}
|
||||
@ -112,6 +87,3 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
|
||||
|
||||
include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php');
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -52,7 +52,8 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<p class='text'>Bienvenue sur le panneau d'administration du site.</p>";
|
||||
echo "<p class='text'>Vous pouvez ici gérer les utilisateurs.</p>";
|
||||
echo "<p class='text'>Que souhaitez-vous faire ?</p>";
|
||||
echo "<p class='text'><a href='/admin/users'>Gérer les utilisateurs</a></p>";
|
||||
echo '<button class="submit-button new-event" onclick="window.location.href = \'/admin/users\';">Gérer les utilisateurs</button>';
|
||||
|
||||
|
||||
;
|
||||
//contenu de la page admin
|
||||
|
7826
diagrams/Cas_usage_connexion.mdj
Normal file
7826
diagrams/Cas_usage_connexion.mdj
Normal file
File diff suppressed because it is too large
Load Diff
41
events/book/index.php
Normal file
41
events/book/index.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
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
|
||||
|
||||
$email = $userData['email'];
|
||||
$name = $userData['name'];
|
||||
$familyName = $userData['familyName'];
|
||||
$role = $userData['role'];
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/styles/main.css" />
|
||||
<link rel="stylesheet" href="/styles/header.css" />
|
||||
<link rel="stylesheet" href="/styles/footer.css" />
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32"
|
||||
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
|
||||
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|
||||
<title>S'inscrire | Jeux Olympiques - Paris 2024</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php') ?>
|
||||
<h1>S'inscrire à un évènement</h1>
|
||||
<!-- code de la page ici -->
|
||||
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -43,23 +43,29 @@
|
||||
-- afficher la liste des évènements (tout le monde)
|
||||
-- Rechercher un évènement par date, lieu, ou nom
|
||||
-->
|
||||
<div class="searchbar">
|
||||
<form action="search" method="get">
|
||||
</form>
|
||||
<input id="searchbar" name="search" placeholder="Rechercher un évènement" type="text">
|
||||
<button type="submit"><i class="fas fa-search"></i> Rechercher</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (isset($_COOKIE['userData'])) {
|
||||
if (($role == 'Administrateur') or ($role == 'Organisateur')) {
|
||||
echo '<button class="submit-button new-event" onclick="window.location.href = \'/events/new\';">Créer un évènement</button>';
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/new\';">Créer un évènement</button>';
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/list\';">Consulter la liste des évènements</button>';
|
||||
|
||||
} else if ($role == 'Sportif') {
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/participate\';">Participer à un évènement</button>';
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/list\';">Consulter la liste des évènements</button>';
|
||||
} else {
|
||||
echo "<p class='text'>Vous n'êtes pas autorisé à créer un évènement.</p>";
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/list\';">Consulter la liste des évènements</button>';
|
||||
}
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/book\';">S\'inscrire un évènement</button>';
|
||||
|
||||
} else {
|
||||
echo '<button class="new-event" onclick="window.location.href = \'/events/list\';">Consulter la liste des évènements</button>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
71
events/list/index.php
Normal file
71
events/list/index.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
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
|
||||
|
||||
$email = $userData['email'];
|
||||
$name = $userData['name'];
|
||||
$familyName = $userData['familyName'];
|
||||
$role = $userData['role'];
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/styles/main.css" />
|
||||
<link rel="stylesheet" href="/styles/header.css" />
|
||||
<link rel="stylesheet" href="/styles/footer.css" />
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32"
|
||||
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
|
||||
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|
||||
<script src="/scripts/dateChecker.js" defer></script>
|
||||
<title>List des évènements | Jeux Olympiques - Paris 2024</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . '/views/header.php' ?>
|
||||
<h1>Liste des évènements</h1>
|
||||
<div class="event-container">
|
||||
<div class="searchbar">
|
||||
<form action="search" method="get">
|
||||
</form>
|
||||
<input id="searchbar" name="search" placeholder="Rechercher un nom d'évènement" type="text">
|
||||
<button type="submit"><i class="fas fa-search"></i> Rechercher</button>
|
||||
</div>
|
||||
|
||||
<!-- menu déroulant permettant d'afficher les lieux pour lesquels un évènement est enregistré dans la base de données avec mysqli-connect ($db)-->
|
||||
<p class="text">Sélectionner un lieu :</p>
|
||||
<select name="location" id="location">
|
||||
|
||||
<?php
|
||||
$query = "SELECT DISTINCT location FROM event";
|
||||
$result = mysqli_query($db, $query);
|
||||
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
echo "<option value='" . $row['location'] . "'>" . $row['location'] . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="event-date">
|
||||
<label for="eventDate">
|
||||
<p class="text">Sélectionner une date:</p>
|
||||
</label>
|
||||
<input type="date" id="eventDate" name="eventDate">
|
||||
</div>
|
||||
|
||||
<!-- code de la page ici -->
|
||||
|
||||
</div>
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . '/views/footer.php' ?>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -40,6 +40,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
if ($result) {
|
||||
echo "<p class='text'>L'évènement a bien été créé.</p>";
|
||||
include ($_SERVER['DOCUMENT_ROOT'] . '/views/discordWebhookNewEvent.php');
|
||||
header("Location: /events/new?result=event-creation-succeded");
|
||||
} else {
|
||||
echo "<p class='text'>Une erreur est survenue lors de la création de l'évènement. Erreur : " . mysqli_error($db) . "</p>";
|
||||
|
@ -48,10 +48,10 @@ if (isset($_COOKIE['userData'])) {
|
||||
$role = $userData['role'];
|
||||
|
||||
if (($role == 'Administrateur') or ($role == 'Organisateur')) { // Si l'utilisateur est un administrateur : accès à la page
|
||||
echo "<div class='event-create-container'>";
|
||||
echo "<div class='event-container'>";
|
||||
echo "<img src='https://cdn-icons-png.flaticon.com/512/2538/2538566.png' alt='Avatar'>";
|
||||
echo "<h2 class='event-create-title'>Créer un nouvel évènement</h2>";
|
||||
echo "<p class='event-create-subtitle'>Remplissez le formulaire suivant afin de créer un nouvel évènement.</p>";
|
||||
echo "<h2 class='event-title'>Créer un nouvel évènement</h2>";
|
||||
echo "<p class='event-subtitle'>Remplissez le formulaire suivant afin de créer un nouvel évènement.</p>";
|
||||
echo "<form method='POST' action='/events/new/eventCreate.php'>";
|
||||
echo "<div class='form-group'>";
|
||||
if (isset($_GET['result'])) {
|
||||
@ -65,8 +65,8 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<label for='eventName'>Nom de l'évènement</label>";
|
||||
echo "<input type='text' name='eventName' id='eventName' required>";
|
||||
echo "</div>";
|
||||
echo "<div class='form-group;
|
||||
<label for='eventDiscipline'>Discipline</label>";
|
||||
echo "<div class='form-group'>";
|
||||
echo "<label for='eventDiscipline'>Discipline</label>";
|
||||
echo "<select name='eventDiscipline' id='eventDiscipline'>";
|
||||
$disciplines = mysqli_query($db, "SELECT discipline FROM `olympic_discipline` ");
|
||||
while ($row = mysqli_fetch_assoc($disciplines)) {
|
||||
@ -74,8 +74,8 @@ if (isset($_COOKIE['userData'])) {
|
||||
}
|
||||
echo "</select>";
|
||||
echo "</div>";
|
||||
echo "<div class='form-group'>;
|
||||
<label for='eventDate'>Date de l'évènement</label>";
|
||||
echo "<div class='form-group'>";
|
||||
echo "<label for='eventDate'>Date de l'évènement</label>";
|
||||
echo "<input type='date' name='eventDate' id='eventDate' required>";
|
||||
echo "</div>";
|
||||
echo "<div class='form-group'>";
|
||||
@ -92,21 +92,21 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<input type='textarea' name='eventDescription' id='eventDescription' required>";
|
||||
echo "</div>";
|
||||
echo "<div class='form-group'>";
|
||||
echo "<label for='eventRole'>Rôles pouvant s'inscrire</label>";
|
||||
echo "<label for='eventRole'>Rôles pouvant s'inscrire (<b><i>en sélectionner au moins un</i></b>)</label>";
|
||||
echo "<div>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='membre' value='membre'>";
|
||||
echo "<label for='membre'>";
|
||||
echo "<p>Membre</p>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='spectateur' value='Spectateur'>";
|
||||
echo "<label for='spectateur'>";
|
||||
echo "<p>Spectateur</p>";
|
||||
echo "</label>";
|
||||
echo "</div>";
|
||||
echo "<div>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='sportif' value='sportif'>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='sportif' value='Sportif'>";
|
||||
echo "<label for='sportif'>";
|
||||
echo "<p>Sportif</p>";
|
||||
echo "</label>";
|
||||
echo "</div>";
|
||||
echo "<div>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='organisateur' value='organisateur'>";
|
||||
echo "<input type='checkbox' name='eventRole[]' id='organisateur' value='Organisateur'>";
|
||||
echo "<label for='organisateur'>";
|
||||
echo "<p>Organisateur</p>";
|
||||
echo "</label>";
|
||||
|
@ -1,116 +0,0 @@
|
||||
<?php
|
||||
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
|
||||
|
||||
$email = $userData['email'];
|
||||
$name = $userData['name'];
|
||||
$familyName = $userData['familyName'];
|
||||
$role = $userData['role'];
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/styles/main.css" />
|
||||
<link rel="stylesheet" href="/styles/header.css" />
|
||||
<link rel="stylesheet" href="/styles/footer.css" />
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32"
|
||||
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
|
||||
<script src="https://kit.fontawesome.com/f16a36bad3.js" crossorigin="anonymous"></script>
|
||||
<title>Jeux Olympiques - Paris 2024</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php') ?>
|
||||
|
||||
|
||||
|
||||
<div class="event-create-container">
|
||||
<img src="https://cdn-icons-png.flaticon.com/512/2538/2538566.png" alt="Avatar">
|
||||
<h2 class="event-create-title">Créer un nouvel évènement</h2>
|
||||
<p class="event-create-subtitle">Remplissez le formulaire suivant afin de créer un nouvel évènement.</p>
|
||||
<form method="POST" action="/events/new/eventCreate.php">
|
||||
<?php
|
||||
if (isset($_GET['result'])) {
|
||||
if ($_GET['result'] == "event-creation-failed") {
|
||||
echo "<p class='text' style='color:red; padding-left:0;'> ⛔ Une erreur est survenue, l'évènement n'a pas été créé.</p>";
|
||||
} else if ($_GET["result"] == "event-creation-succeded") {
|
||||
echo "<p class='text' style='color:green; padding-left:0;'> ✅ L'évènement a bien été créé.</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="eventName">Nom de l'évènement</label>
|
||||
<input type="text" name="eventName" id="eventName" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="eventDiscipline">Discipline</label>
|
||||
<select name="eventDiscipline" id="eventDiscipline">
|
||||
<?php
|
||||
$disciplines = mysqli_query($db, "SELECT discipline FROM `olympic_discipline` ");
|
||||
while ($row = mysqli_fetch_assoc($disciplines)) {
|
||||
echo "<option>" . $row['discipline'] . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="eventDate">Date de l'évènement</label>
|
||||
<input type="date" name="eventDate" id="eventDate" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="eventLocation">Lieu de l'évènement<select name="eventLocation" id="eventLocation">
|
||||
<?php
|
||||
$locations = mysqli_query($db, "SELECT venue_info FROM `olympic_location` ");
|
||||
while ($row = mysqli_fetch_assoc($locations)) {
|
||||
echo "<option>" . $row['venue_info'] . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="eventDescription">Description de l'évènement</label>
|
||||
<input type="textarea" name="eventDescription" id="eventDescription" required>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="eventRole">Rôles pouvant s'inscrire</label>
|
||||
<div>
|
||||
<input type="checkbox" name="eventRole[]" id="membre" value="membre">
|
||||
<label for="membre">
|
||||
<p>Membre</p>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="checkbox" name="eventRole[]" id="sportif" value="sportif">
|
||||
<label for="sportif">
|
||||
<p>Sportif</p>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="checkbox" name="eventRole[]" id="organisateur" value="organisateur">
|
||||
<label for="organisateur">
|
||||
<p>Organisateur</p>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="submit-button"><i class="fas fa-calendar-plus"></i> Créer</i></button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>
|
||||
</body>
|
||||
|
||||
</html>
|
49
events/participate/index.php
Normal file
49
events/participate/index.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
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
|
||||
|
||||
$email = $userData['email'];
|
||||
$name = $userData['name'];
|
||||
$familyName = $userData['familyName'];
|
||||
$role = $userData['role'];
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/styles/main.css" />
|
||||
<link rel="stylesheet" href="/styles/header.css" />
|
||||
<link rel="stylesheet" href="/styles/footer.css" />
|
||||
<link
|
||||
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="32x32"
|
||||
href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png"
|
||||
/>
|
||||
<script
|
||||
src="https://kit.fontawesome.com/f16a36bad3.js"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<title>Jeux Olympiques - Paris 2024</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php') ?>
|
||||
|
||||
<!-- code de la page ici -->
|
||||
|
||||
<?php include($_SERVER['DOCUMENT_ROOT'].'/views/footer.php')?>
|
||||
</body>
|
||||
</html>
|
25
index.php
25
index.php
@ -1,3 +1,18 @@
|
||||
<?php
|
||||
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
|
||||
|
||||
$email = $userData['email'];
|
||||
$name = $userData['name'];
|
||||
$familyName = $userData['familyName'];
|
||||
$role = $userData['role'];
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@ -27,7 +42,13 @@
|
||||
|
||||
<!-- code de la page ici -->
|
||||
<h1>Accueil</h1>
|
||||
<p class="text">Bienvenue sur le site des Jeux Olympiques de Paris 2024 !</p>
|
||||
<p class="text">Bienvenue <?php
|
||||
if (isset($_GET['res'])) {
|
||||
if ($_GET['res'] == "login-succeeded") {
|
||||
echo "<span >" . $name . " " . $familyName . ",</span>";
|
||||
}
|
||||
}
|
||||
?> sur le site des Jeux Olympiques de Paris 2024 !</p>
|
||||
<p class="text">Vous trouverez ici toutes les informations nécessaires pour suivre les Jeux Olympiques de Paris
|
||||
2024.</p>
|
||||
<p class="text">Vous pourrez également créer un compte pour accéder à des fonctionnalités supplémentaires.</p>
|
||||
@ -38,7 +59,7 @@
|
||||
</form>
|
||||
<input id="searchbar" name="search" placeholder="Rechercher évènement" type="text">
|
||||
<button type="submit"><i class="fas fa-search"></i> Rechercher</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
@ -1,17 +0,0 @@
|
||||
// JavaScript code
|
||||
function rechercher_evenement() {
|
||||
let input = document.getElementById("searchbar").value;
|
||||
input = input.toLowerCase();
|
||||
let x = document.getElementsByClassName("animals");
|
||||
|
||||
for (i = 0; i < x.length; i++) {
|
||||
if (!x[i].innerHTML.toLowerCase().includes(input)) {
|
||||
x[i].style.display = "none";
|
||||
} else {
|
||||
x[i].style.display = "list-item";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//INSERT INTO olympic_discipline
|
||||
//VALUES (name='Athlétisme',id='1');
|
@ -32,7 +32,7 @@ body {
|
||||
}
|
||||
|
||||
.menu-logo img {
|
||||
max-height: 50px;
|
||||
max-height: 65px;
|
||||
max-width: 100px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
@ -210,7 +210,7 @@ body {
|
||||
background-color: #26272b; /* Même couleur que le container */
|
||||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* Ombre pour le menu déroulant */
|
||||
z-index: 100;
|
||||
width: 220px; /* ou la largeur qui correspond le mieux à votre design */
|
||||
width: 270px; /* ou la largeur qui correspond le mieux à votre design */
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
@ -229,7 +229,7 @@ body {
|
||||
transition: opacity 0.5s ease; /* Transition douce pour l'opacité */
|
||||
}
|
||||
.dropdown-content {
|
||||
opacity: 0; /* Initialement transparent */
|
||||
opacity: 0; /* transparent */
|
||||
transition: opacity 0.5s ease; /* Transition pour une apparition douce */
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
@font-face {
|
||||
font-family: "RobotoFlex";
|
||||
src: url(../assets/fonts/RobotoFlex.ttf);
|
||||
src: url(/assets/fonts/RobotoFlex.ttf);
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@ -45,6 +45,11 @@ body::before {
|
||||
margin-inline: auto;
|
||||
margin-block: 5em;
|
||||
}
|
||||
.form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.login-container img {
|
||||
width: 146px;
|
||||
@ -73,6 +78,7 @@ p.login-subtitle {
|
||||
.form-group {
|
||||
margin-bottom: 1rem;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
@ -237,7 +243,7 @@ td {
|
||||
margin-block: 5em;
|
||||
}
|
||||
|
||||
.event-create-container {
|
||||
.event-container {
|
||||
background: #26272b;
|
||||
align-items: center;
|
||||
opacity: 1;
|
||||
@ -321,33 +327,47 @@ input[type="checkbox"]:checked + label::after {
|
||||
color: #fffe; /* Couleur du texte des options */
|
||||
}
|
||||
|
||||
.event-create-container img {
|
||||
.event-container img {
|
||||
width: 146px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.event-create-container h2 {
|
||||
.event-container h2 {
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.event-create-container p {
|
||||
.event-container p {
|
||||
margin-bottom: 1.5rem;
|
||||
color: #8e8c8c;
|
||||
size: 10px;
|
||||
}
|
||||
|
||||
h2.event-create-title {
|
||||
h2.event-title {
|
||||
font-family: "RobotoFlex";
|
||||
}
|
||||
|
||||
p.event-create-subtitle {
|
||||
p.event-subtitle {
|
||||
font-family: "RobotoFlex";
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
button.new-event {
|
||||
width: 25%;
|
||||
margin: auto;
|
||||
margin-bottom: 1rem;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding: 10px 0;
|
||||
border: none;
|
||||
background-color: #f4b400;
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
button.new-event:hover {
|
||||
background-color: #f4a400;
|
||||
}
|
||||
/* Styles pour le calendrier*/
|
||||
|
77
views/discordWebhookLogin.php
Normal file
77
views/discordWebhookLogin.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
// Code fork depuis https://stackoverflow.com/a/51748785
|
||||
|
||||
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
|
||||
|
||||
$email = $userData['email'];
|
||||
$name = $userData['name'];
|
||||
$familyName = $userData['familyName'];
|
||||
$role = $userData['role'];
|
||||
}
|
||||
|
||||
$url = "https://discord.com/api/webhooks/1251174147707506760/9nzTCgf9KQBDm6gjbbJCNgXfwrnSZhdFM3-ysp5_DGeUm0PABxyoYwTBn-HyJ0P6heCY";
|
||||
|
||||
$hookObject = json_encode([
|
||||
"content" => "## ✅ Nouvelle connexion au site des Jeux Olympiques de Paris 2024 ! \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://but.lbalocchi.fr/",
|
||||
],
|
||||
|
||||
// Field array of objects
|
||||
"fields" => [
|
||||
[
|
||||
"name" => "Nom de l'utilisateur",
|
||||
"value" => $nameFetched . " " . $familyNameFetched,
|
||||
"inline" => false
|
||||
],
|
||||
[
|
||||
"name" => "Adresse mail de l'utilisateur",
|
||||
"value" => $email,
|
||||
"inline" => true
|
||||
],
|
||||
[
|
||||
"name" => "Rôle de l'utilisateur",
|
||||
"value" => $roleFetched,
|
||||
"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);
|
||||
?>
|
98
views/discordWebhookNewEvent.php
Normal file
98
views/discordWebhookNewEvent.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
// Code fork depuis https://stackoverflow.com/a/51748785
|
||||
|
||||
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
|
||||
|
||||
$email = $userData['email'];
|
||||
$name = $userData['name'];
|
||||
$familyName = $userData['familyName'];
|
||||
$role = $userData['role'];
|
||||
}
|
||||
|
||||
$url = "https://discord.com/api/webhooks/1251196052133118013/euJIbUIfmdXK0MJsS6WoEDLm2ipPV_efb1gLOeUaP3IZNIM4MRdqu2RuOWbVF_09d2ty";
|
||||
|
||||
$hookObject = json_encode([
|
||||
"content" => "## ✅ Nouvel évènement créé sur le site des Jeux Olympiques de Paris 2024 ! \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://but.lbalocchi.fr/",
|
||||
],
|
||||
|
||||
// Field array of objects
|
||||
"fields" => [
|
||||
// en cas de nouvel évènement créé, notifie via un webhook des informations suivantes concernant l'évènement : Nom de l'évènement, Discipline, Date de l'évènement, Lieu de l'évènement, Description de l'évènement, Rôles pouvant s'inscrire
|
||||
[
|
||||
"name" => "Nom de l'évènement",
|
||||
"value" => $eventName,
|
||||
"inline" => false
|
||||
],
|
||||
[
|
||||
"name" => "Discipline",
|
||||
"value" => $eventDiscipline,
|
||||
"inline" => true
|
||||
],
|
||||
[
|
||||
"name" => "Date de l'évènement",
|
||||
"value" => $eventDate,
|
||||
"inline" => true
|
||||
],
|
||||
[
|
||||
"name" => "Lieu de l'évènement",
|
||||
"value" => $eventLocation,
|
||||
"inline" => true
|
||||
],
|
||||
[
|
||||
"name" => "Description de l'évènement",
|
||||
"value" => $eventDescription,
|
||||
"inline" => true
|
||||
],
|
||||
[
|
||||
"name" => "Rôles pouvant s'inscrire",
|
||||
"value" => $rolesText,
|
||||
"inline" => true
|
||||
],
|
||||
[
|
||||
"name" => "Créateur de l'évènement",
|
||||
"value" => $name . " " . $familyName . " (" . $role . ")\n" . $email,
|
||||
"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);
|
||||
?>
|
77
views/discordWebhookRegister.php
Normal file
77
views/discordWebhookRegister.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
// Code fork depuis https://stackoverflow.com/a/51748785
|
||||
|
||||
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
|
||||
|
||||
$email = $userData['email'];
|
||||
$name = $userData['name'];
|
||||
$familyName = $userData['familyName'];
|
||||
$role = $userData['role'];
|
||||
}
|
||||
|
||||
$url = "https://discord.com/api/webhooks/1251195948969889893/ul_eB43XfEHoulUbS5YcsiJ2BWdTt4oLxgA_ZD9e7SFbyYYtfYU0HFR5ixE8WmMKjtSY";
|
||||
|
||||
$hookObject = json_encode([
|
||||
"content" => "## ➕ Nouvel utilisateur enregistré sur le site des Jeux Olympiques de Paris 2024 !",
|
||||
"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://but.lbalocchi.fr/",
|
||||
],
|
||||
|
||||
// Field array of objects
|
||||
"fields" => [
|
||||
[
|
||||
"name" => "Nom de l'utilisateur",
|
||||
"value" => $name . " " . $familyName,
|
||||
"inline" => false
|
||||
],
|
||||
[
|
||||
"name" => "Adresse mail de l'utilisateur",
|
||||
"value" => $email,
|
||||
"inline" => true
|
||||
],
|
||||
[
|
||||
"name" => "Rôle de l'utilisateur",
|
||||
"value" => $role,
|
||||
"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);
|
||||
?>
|
@ -22,7 +22,13 @@ if (isset($_COOKIE['userData'])) {
|
||||
<span></span>
|
||||
|
||||
<!-- logo -->
|
||||
<a href="../../../" class="menu-logo">
|
||||
<a href="<?php
|
||||
if (isset($_COOKIE['userData'])) {
|
||||
echo "/?res=login-succeeded";
|
||||
} else {
|
||||
echo "/";
|
||||
}
|
||||
?>" class="menu-logo">
|
||||
<img src="https://i.imgur.com/RkmSo9Q.png" alt="Jeux Olympiques - Paris 2024" />
|
||||
</a>
|
||||
|
||||
@ -37,8 +43,7 @@ if (isset($_COOKIE['userData'])) {
|
||||
echo "<a href='/admin'>Panel d'administration</a>";
|
||||
echo "<ul class='dropdown-content'>";
|
||||
echo "<li><a href='/admin/users'>Gérer les utilisateurs</a></li>"; //option 1
|
||||
echo "<li><a href='/admin/type2'>Événement Type 2</a></li>";
|
||||
echo "<li><a href='/admin/type3'>Événement Type 3</a></li>";
|
||||
|
||||
echo "</ul>";
|
||||
echo "</li>";
|
||||
}
|
||||
@ -48,9 +53,30 @@ if (isset($_COOKIE['userData'])) {
|
||||
<li class="dropdown">
|
||||
<a href="/events">Évènements</a>
|
||||
<ul class="dropdown-content">
|
||||
<li><a href="/events/type1">Événement Type 1</a></li>
|
||||
<li><a href="/events/type2">Événement Type 2</a></li>
|
||||
<li><a href="/events/type3">Événement Type 3</a></li>
|
||||
<?php
|
||||
if (isset($_COOKIE['userData'])) {
|
||||
$role = $userData['role'];
|
||||
if ($role == 'Administrateur') {
|
||||
echo "<li><a href='/events/new'>Créer un nouvel évènement</a></li>";
|
||||
echo "<li><a href='/events/list'>Liste des évènements</a></li>";
|
||||
echo "<li><a href='/events/book'>S'inscrire à un évènement</a></li>";
|
||||
} else if ($role == 'Sportif') {
|
||||
echo "<li><a href='/events/participate'>Participer à un évènement</a></li>";
|
||||
echo "<li><a href='/events/list'>Liste des évènements</a></li>";
|
||||
echo "<li><a href='/events/book'>S'inscrire à un évènement</a></li>";
|
||||
} else if ($role == "Organisateur") {
|
||||
echo "<li><a href='/events/new'>Créer un nouvel évènement</a></li>";
|
||||
echo "<li><a href='/events/list'>Liste des évènements</a></li>";
|
||||
echo "<li><a href='/events/book'>S'inscrire à un évènement</a></li>";
|
||||
} else if ($role == "Membre") {
|
||||
echo "<li><a href='/events/list'>Liste des évènements</a></li>";
|
||||
echo "<li><a href='/events/book'>S'inscrire à un évènement</a></li>";
|
||||
}
|
||||
} else {
|
||||
echo "<li><a href='/events/list'>Liste des évènements</a></li>";
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user