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
|
# Persistent undo
|
||||||
[._]*.un~
|
[._]*.un~
|
||||||
|
|
||||||
|
|
||||||
|
.mdj
|
@ -36,7 +36,7 @@ if (isset($_COOKIE['userData'])) {
|
|||||||
<img src="https://cdn-icons-png.flaticon.com/512/4139/4139948.png" alt="Avatar">
|
<img src="https://cdn-icons-png.flaticon.com/512/4139/4139948.png" alt="Avatar">
|
||||||
<h2 class="login-title">Connexion à votre compte</h2>
|
<h2 class="login-title">Connexion à votre compte</h2>
|
||||||
<p class="login-subtitle">Connectez-vous afin d'accéder à l'entièreté du site.</p>
|
<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">
|
<div class="form-group">
|
||||||
<label for="email">Adresse mail</label>
|
<label for="email">Adresse mail</label>
|
||||||
<input type="email" id="email" name="email" placeholder="username@example.com" required placeholder=" ">
|
<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>
|
<label for="password">Mot de passe</label>
|
||||||
<input type="password" id="password" name="password" required placeholder="••••••••" placeholder=" ">
|
<input type="password" id="password" name="password" required placeholder="••••••••" placeholder=" ">
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
<div class="form-group forgot-password">
|
if (isset($_GET['res'])) {
|
||||||
</div>
|
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>
|
<button type="submit" class="submit-button"><i class="fas fa-sign-in-alt"></i>
|
||||||
Connexion</i></button>
|
Connexion</i></button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -1,93 +1,59 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once ($_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php');
|
require_once ($_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php');
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
$email = htmlspecialchars($_POST["email"]);
|
$email = htmlspecialchars($_POST["email"]);
|
||||||
$password = htmlspecialchars($_POST["password"]);
|
$password = htmlspecialchars($_POST["password"]);
|
||||||
}
|
}
|
||||||
|
if (isset($_COOKIE['userData'])) {
|
||||||
/*
|
header("Location: /account/profile");
|
||||||
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
|
|
||||||
$hashedPassword = sha1($password);
|
$hashedPassword = sha1($password);
|
||||||
$resultat = mysqli_query($db, "SELECT *
|
$stmt = mysqli_prepare($db, "SELECT * FROM user WHERE mail = ? AND password = ?");
|
||||||
FROM user
|
mysqli_stmt_bind_param($stmt, 'ss', $email, $hashedPassword);
|
||||||
WHERE mail = '$email' AND password = '$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) {
|
if (!$result) {
|
||||||
die("Erreur lors de l'exécution de la requête.");
|
die('Erreur de requête : ' . mysqli_error($db));
|
||||||
}
|
|
||||||
|
|
||||||
if (!$password) {
|
|
||||||
die("Combinaison email/mot de passe incorrecte.");
|
|
||||||
}
|
|
||||||
if (!$email) {
|
|
||||||
die("Combinaison email/mot de passe incorrecte.");
|
|
||||||
} else {
|
} else {
|
||||||
echo "<p>Connexion réussie</p>";
|
if (mysqli_num_rows($result) == 0) {
|
||||||
|
header("Location: /account/login?res=login-failed");
|
||||||
// Requête pour récupérer les informations de l'utilisateur
|
die();
|
||||||
$query = "SELECT name, family_name, role FROM user WHERE mail = '$email'";
|
|
||||||
$result = mysqli_query($db, $query);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
die('Erreur de requête : ' . mysqli_error($db));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Récupération des données
|
|
||||||
if ($row = mysqli_fetch_assoc($result)) {
|
|
||||||
$nameFetched = $row['name'];
|
|
||||||
$familyNameFetched = $row['family_name'];
|
|
||||||
$roleFetched = $row['role'];
|
|
||||||
} else {
|
} else {
|
||||||
echo "Aucun utilisateur trouvé avec cet email.";
|
// 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);
|
||||||
|
|
||||||
|
if (!$result) {
|
||||||
|
die('Erreur de requête : ' . mysqli_error($db));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Récupération des données
|
||||||
|
if ($row = mysqli_fetch_assoc($result)) {
|
||||||
|
$nameFetched = $row['name'];
|
||||||
|
$familyNameFetched = $row['family_name'];
|
||||||
|
$roleFetched = $row['role'];
|
||||||
|
} 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]
|
||||||
|
|
||||||
|
include ($_SERVER['DOCUMENT_ROOT'] . '/views/discordWebhookLogin.php');
|
||||||
|
|
||||||
|
header("Location: /?res=login-succeeded");
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$userData = array(
|
|
||||||
"email" => $email,
|
|
||||||
"name" => $nameFetched,
|
|
||||||
"familyName" => $familyNameFetched,
|
|
||||||
"role" => $roleFetched
|
|
||||||
);
|
|
||||||
|
|
||||||
$userDataEncoded = json_encode($userData);
|
|
||||||
|
|
||||||
setcookie("userData", $userDataEncoded, time() + 3600, "/");
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($_COOKIE['userData'])) {
|
|
||||||
$userDataEncoded = $_COOKIE['userData'];
|
|
||||||
$userData = json_decode($userDataEncoded, true); // 'true' pour obtenir un tableau associatif
|
|
||||||
|
|
||||||
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);
|
|
||||||
die();
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
@ -9,109 +9,81 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/tools/dbConnect.php';
|
|||||||
- enregistrer le nouvel utilisateur dans la bdd
|
- enregistrer le nouvel utilisateur dans la bdd
|
||||||
- créer un cookie avec mail, nom, prénom, rôle. Qui expire dans 1h
|
- créer un cookie avec mail, nom, prénom, rôle. Qui expire dans 1h
|
||||||
*/
|
*/
|
||||||
?>
|
include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php');
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
$name = htmlspecialchars($_POST["name"]);
|
||||||
|
$familyName = htmlspecialchars($_POST["family_name"]);
|
||||||
|
$email = htmlspecialchars($_POST["email"]);
|
||||||
|
$password = htmlspecialchars($_POST["password"]);
|
||||||
|
$codeRole = htmlspecialchars($_POST["code-role"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$hashedPassword = sha1($password);
|
||||||
|
|
||||||
<!DOCTYPE html>
|
$query = "SELECT mail FROM user WHERE mail = '$email'";
|
||||||
<html lang="fr">
|
$result = mysqli_query($db, $query);
|
||||||
|
|
||||||
<head>
|
if (!$result) {
|
||||||
<meta charset="UTF-8" />
|
die("Erreur lors de l'exécution de la requête.");
|
||||||
<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"
|
$row = mysqli_fetch_assoc($result);
|
||||||
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>
|
if ($row) {
|
||||||
<?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php');
|
die("<p>Un utilisateur avec cette adresse mail existe déjà.</p>");
|
||||||
|
}
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($codeRole == "M25QP") {
|
||||||
$name = htmlspecialchars($_POST["name"]);
|
$role = "Administrateur";
|
||||||
$familyName = htmlspecialchars($_POST["family_name"]);
|
} else if ($codeRole == "TF53K") {
|
||||||
$email = htmlspecialchars($_POST["email"]);
|
$role = "Sportif";
|
||||||
$password = htmlspecialchars($_POST["password"]);
|
} else if ($codeRole == "VJC6V") {
|
||||||
$codeRole = htmlspecialchars($_POST["code-role"]);
|
$role = "Organisateur";
|
||||||
}
|
} else {
|
||||||
|
$role = "Spectateur";
|
||||||
|
}
|
||||||
|
|
||||||
$hashedPassword = sha1($password);
|
$addUser = "INSERT INTO `user`(`mail`, `name`, `family_name`, `role`, `password`) VALUES ('$email', '$name', '$familyName', '$role', '$hashedPassword')";
|
||||||
|
|
||||||
$query = "SELECT mail FROM user WHERE mail = '$email'";
|
$resultAddUser = mysqli_query($db, $addUser);
|
||||||
$result = mysqli_query($db, $query);
|
if (!$resultAddUser) {
|
||||||
|
echo "<p class='text'>Erreur lors de l'exécution de la requête.</p>";
|
||||||
|
} else {
|
||||||
|
if (mysqli_affected_rows($db) > 0) {
|
||||||
|
echo "<p class='text'>Utilisateur créé avec succès. </p>";
|
||||||
|
|
||||||
if (!$result) {
|
// Créer un tableau avec les données utilisateur
|
||||||
die("Erreur lors de l'exécution de la requête.");
|
$userData = array(
|
||||||
}
|
"email" => $email,
|
||||||
|
"name" => $name,
|
||||||
|
"familyName" => $familyName,
|
||||||
|
"role" => $role,
|
||||||
|
);
|
||||||
|
// Sérialiser le tableau en JSON
|
||||||
|
$userDataEncoded = json_encode($userData);
|
||||||
|
// Stocker les données sérialisées dans un cookie
|
||||||
|
setcookie("userData", $userDataEncoded, time() + 3600, "/");
|
||||||
|
|
||||||
$row = mysqli_fetch_assoc($result);
|
echo "<p class='text'>Cookie créé avec succès. Contenu du cookie :</p>";
|
||||||
|
echo "<p class='text'>" . $userDataEncoded . "</p>";
|
||||||
|
|
||||||
if ($row) {
|
echo "<p class='text'>Prénom : " . $name . "</p>";
|
||||||
die("<p>Un utilisateur avec cette adresse mail existe déjà.</p>");
|
echo "<p class='text'>Nom : " . $familyName . "</p>";
|
||||||
}
|
echo "<p class='text'>Adresse mail : " . $email . "</p>";
|
||||||
|
echo "<p class='text'>Mot de passe : " . $password . "</p>";
|
||||||
if ($codeRole == "M25QP") {
|
echo "<p class='text'>Mot de passe hashé : " . $hashedPassword . "</p>";
|
||||||
$role = "Administrateur";
|
echo "<p class='text'>Rôle : " . $role . "</p>";
|
||||||
} else if ($codeRole == "TF53K") {
|
include ($_SERVER['DOCUMENT_ROOT'] . '/views/discordWebhookRegister.php');
|
||||||
$role = "Sportif";
|
header("Location: /?res=login-succeeded");
|
||||||
} else if ($codeRole == "VJC6V") {
|
die();
|
||||||
$role = "Organisateur";
|
|
||||||
} else if ($codeRole == "XJ9LQ") {
|
|
||||||
$role = "Spectateur";
|
|
||||||
} else {
|
} else {
|
||||||
$role = "Membre";
|
echo "<p class='text'>Aucun utilisateur n\'a été ajouté.</p>";
|
||||||
}
|
|
||||||
|
|
||||||
$addUser = "INSERT INTO `user`(`mail`, `name`, `family_name`, `role`, `password`) VALUES ('$email', '$name', '$familyName', '$role', '$hashedPassword')";
|
|
||||||
|
|
||||||
$resultAddUser = mysqli_query($db, $addUser);
|
|
||||||
if (!$resultAddUser) {
|
|
||||||
echo "<p class='text'>Erreur lors de l'exécution de la requête.</p>";
|
|
||||||
} else {
|
|
||||||
if (mysqli_affected_rows($db) > 0) {
|
|
||||||
echo "<p class='text'>Utilisateur créé avec succès. </p>";
|
|
||||||
|
|
||||||
// Créer un tableau avec les données utilisateur
|
|
||||||
$userData = array(
|
|
||||||
"email" => $email,
|
|
||||||
"name" => $name,
|
|
||||||
"familyName" => $familyName,
|
|
||||||
"role" => $role,
|
|
||||||
);
|
|
||||||
// Sérialiser le tableau en JSON
|
|
||||||
$userDataEncoded = json_encode($userData);
|
|
||||||
// Stocker les données sérialisées dans un cookie
|
|
||||||
setcookie("userData", $userDataEncoded, time() + 3600, "/");
|
|
||||||
|
|
||||||
echo "<p class='text'>Cookie créé avec succès. Contenu du cookie :</p>";
|
|
||||||
echo "<p class='text'>" . $userDataEncoded . "</p>";
|
|
||||||
|
|
||||||
echo "<p class='text'>Prénom : " . $name . "</p>";
|
|
||||||
echo "<p class='text'>Nom : " . $familyName . "</p>";
|
|
||||||
echo "<p class='text'>Adresse mail : " . $email . "</p>";
|
|
||||||
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
|
|
||||||
} else {
|
|
||||||
echo "<p class='text'>Aucun utilisateur n\'a été ajouté.</p>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.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'>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'>Vous pouvez ici gérer les utilisateurs.</p>";
|
||||||
echo "<p class='text'>Que souhaitez-vous faire ?</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
|
//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)
|
-- afficher la liste des évènements (tout le monde)
|
||||||
-- Rechercher un évènement par date, lieu, ou nom
|
-- 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
|
<?php
|
||||||
if (isset($_COOKIE['userData'])) {
|
if (isset($_COOKIE['userData'])) {
|
||||||
if (($role == 'Administrateur') or ($role == 'Organisateur')) {
|
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 {
|
} 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) {
|
if ($result) {
|
||||||
echo "<p class='text'>L'évènement a bien été créé.</p>";
|
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");
|
header("Location: /events/new?result=event-creation-succeded");
|
||||||
} else {
|
} else {
|
||||||
echo "<p class='text'>Une erreur est survenue lors de la création de l'évènement. Erreur : " . mysqli_error($db) . "</p>";
|
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'];
|
$role = $userData['role'];
|
||||||
|
|
||||||
if (($role == 'Administrateur') or ($role == 'Organisateur')) { // Si l'utilisateur est un administrateur : accès à la page
|
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 "<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 "<h2 class='event-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 "<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 "<form method='POST' action='/events/new/eventCreate.php'>";
|
||||||
echo "<div class='form-group'>";
|
echo "<div class='form-group'>";
|
||||||
if (isset($_GET['result'])) {
|
if (isset($_GET['result'])) {
|
||||||
@ -65,8 +65,8 @@ if (isset($_COOKIE['userData'])) {
|
|||||||
echo "<label for='eventName'>Nom de l'évènement</label>";
|
echo "<label for='eventName'>Nom de l'évènement</label>";
|
||||||
echo "<input type='text' name='eventName' id='eventName' required>";
|
echo "<input type='text' name='eventName' id='eventName' required>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
echo "<div class='form-group;
|
echo "<div class='form-group'>";
|
||||||
<label for='eventDiscipline'>Discipline</label>";
|
echo "<label for='eventDiscipline'>Discipline</label>";
|
||||||
echo "<select name='eventDiscipline' id='eventDiscipline'>";
|
echo "<select name='eventDiscipline' id='eventDiscipline'>";
|
||||||
$disciplines = mysqli_query($db, "SELECT discipline FROM `olympic_discipline` ");
|
$disciplines = mysqli_query($db, "SELECT discipline FROM `olympic_discipline` ");
|
||||||
while ($row = mysqli_fetch_assoc($disciplines)) {
|
while ($row = mysqli_fetch_assoc($disciplines)) {
|
||||||
@ -74,8 +74,8 @@ if (isset($_COOKIE['userData'])) {
|
|||||||
}
|
}
|
||||||
echo "</select>";
|
echo "</select>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
echo "<div class='form-group'>;
|
echo "<div class='form-group'>";
|
||||||
<label for='eventDate'>Date de l'évènement</label>";
|
echo "<label for='eventDate'>Date de l'évènement</label>";
|
||||||
echo "<input type='date' name='eventDate' id='eventDate' required>";
|
echo "<input type='date' name='eventDate' id='eventDate' required>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
echo "<div class='form-group'>";
|
echo "<div class='form-group'>";
|
||||||
@ -92,21 +92,21 @@ if (isset($_COOKIE['userData'])) {
|
|||||||
echo "<input type='textarea' name='eventDescription' id='eventDescription' required>";
|
echo "<input type='textarea' name='eventDescription' id='eventDescription' required>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
echo "<div class='form-group'>";
|
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 "<div>";
|
||||||
echo "<input type='checkbox' name='eventRole[]' id='membre' value='membre'>";
|
echo "<input type='checkbox' name='eventRole[]' id='spectateur' value='Spectateur'>";
|
||||||
echo "<label for='membre'>";
|
echo "<label for='spectateur'>";
|
||||||
echo "<p>Membre</p>";
|
echo "<p>Spectateur</p>";
|
||||||
echo "</label>";
|
echo "</label>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
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 "<label for='sportif'>";
|
||||||
echo "<p>Sportif</p>";
|
echo "<p>Sportif</p>";
|
||||||
echo "</label>";
|
echo "</label>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
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 "<label for='organisateur'>";
|
||||||
echo "<p>Organisateur</p>";
|
echo "<p>Organisateur</p>";
|
||||||
echo "</label>";
|
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>
|
<!DOCTYPE html>
|
||||||
<html lang="fr">
|
<html lang="fr">
|
||||||
|
|
||||||
@ -27,7 +42,13 @@
|
|||||||
|
|
||||||
<!-- code de la page ici -->
|
<!-- code de la page ici -->
|
||||||
<h1>Accueil</h1>
|
<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
|
<p class="text">Vous trouverez ici toutes les informations nécessaires pour suivre les Jeux Olympiques de Paris
|
||||||
2024.</p>
|
2024.</p>
|
||||||
<p class="text">Vous pourrez également créer un compte pour accéder à des fonctionnalités supplémentaires.</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>
|
</form>
|
||||||
<input id="searchbar" name="search" placeholder="Rechercher évènement" type="text">
|
<input id="searchbar" name="search" placeholder="Rechercher évènement" type="text">
|
||||||
<button type="submit"><i class="fas fa-search"></i> Rechercher</button>
|
<button type="submit"><i class="fas fa-search"></i> Rechercher</button>
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?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 {
|
.menu-logo img {
|
||||||
max-height: 50px;
|
max-height: 65px;
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ body {
|
|||||||
background-color: #26272b; /* Même couleur que le container */
|
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 */
|
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* Ombre pour le menu déroulant */
|
||||||
z-index: 100;
|
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%;
|
left: 50%;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ body {
|
|||||||
transition: opacity 0.5s ease; /* Transition douce pour l'opacité */
|
transition: opacity 0.5s ease; /* Transition douce pour l'opacité */
|
||||||
}
|
}
|
||||||
.dropdown-content {
|
.dropdown-content {
|
||||||
opacity: 0; /* Initialement transparent */
|
opacity: 0; /* transparent */
|
||||||
transition: opacity 0.5s ease; /* Transition pour une apparition douce */
|
transition: opacity 0.5s ease; /* Transition pour une apparition douce */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: "RobotoFlex";
|
font-family: "RobotoFlex";
|
||||||
src: url(../assets/fonts/RobotoFlex.ttf);
|
src: url(/assets/fonts/RobotoFlex.ttf);
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +45,11 @@ body::before {
|
|||||||
margin-inline: auto;
|
margin-inline: auto;
|
||||||
margin-block: 5em;
|
margin-block: 5em;
|
||||||
}
|
}
|
||||||
|
.form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.login-container img {
|
.login-container img {
|
||||||
width: 146px;
|
width: 146px;
|
||||||
@ -73,6 +78,7 @@ p.login-subtitle {
|
|||||||
.form-group {
|
.form-group {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group label {
|
.form-group label {
|
||||||
@ -237,7 +243,7 @@ td {
|
|||||||
margin-block: 5em;
|
margin-block: 5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-create-container {
|
.event-container {
|
||||||
background: #26272b;
|
background: #26272b;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
@ -321,33 +327,47 @@ input[type="checkbox"]:checked + label::after {
|
|||||||
color: #fffe; /* Couleur du texte des options */
|
color: #fffe; /* Couleur du texte des options */
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-create-container img {
|
.event-container img {
|
||||||
width: 146px;
|
width: 146px;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-create-container h2 {
|
.event-container h2 {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-create-container p {
|
.event-container p {
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
color: #8e8c8c;
|
color: #8e8c8c;
|
||||||
size: 10px;
|
size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2.event-create-title {
|
h2.event-title {
|
||||||
font-family: "RobotoFlex";
|
font-family: "RobotoFlex";
|
||||||
}
|
}
|
||||||
|
|
||||||
p.event-create-subtitle {
|
p.event-subtitle {
|
||||||
font-family: "RobotoFlex";
|
font-family: "RobotoFlex";
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.new-event {
|
button.new-event {
|
||||||
width: 25%;
|
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>
|
<span></span>
|
||||||
|
|
||||||
<!-- logo -->
|
<!-- 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" />
|
<img src="https://i.imgur.com/RkmSo9Q.png" alt="Jeux Olympiques - Paris 2024" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@ -37,8 +43,7 @@ if (isset($_COOKIE['userData'])) {
|
|||||||
echo "<a href='/admin'>Panel d'administration</a>";
|
echo "<a href='/admin'>Panel d'administration</a>";
|
||||||
echo "<ul class='dropdown-content'>";
|
echo "<ul class='dropdown-content'>";
|
||||||
echo "<li><a href='/admin/users'>Gérer les utilisateurs</a></li>"; //option 1
|
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 "</ul>";
|
||||||
echo "</li>";
|
echo "</li>";
|
||||||
}
|
}
|
||||||
@ -48,9 +53,30 @@ if (isset($_COOKIE['userData'])) {
|
|||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="/events">Évènements</a>
|
<a href="/events">Évènements</a>
|
||||||
<ul class="dropdown-content">
|
<ul class="dropdown-content">
|
||||||
<li><a href="/events/type1">Événement Type 1</a></li>
|
<?php
|
||||||
<li><a href="/events/type2">Événement Type 2</a></li>
|
if (isset($_COOKIE['userData'])) {
|
||||||
<li><a href="/events/type3">Événement Type 3</a></li>
|
$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>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user