Compare commits

..

3 Commits

23 changed files with 248 additions and 1044 deletions

View File

@ -1,215 +1,84 @@
/*Pour toutes les pages : */ /*Pour toutes les pages : */
html, body { body{background-color: #ffffff}
height: 100%;
margin: 0;
}
body { header {font-size: 23px;
display: flex; background-color: #333;
flex-direction: column; color: #fff;
min-height: 100dvh; /* Utilisez 100vh pour une hauteur complète de la fenêtre */ padding: 10px 0;
background-image: url(../img/jo20244.jpeg); text-align: center;
background-size: cover; }
overflow-x: hidden;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
}
body::before{ h1.Hello {font-size: 50px;
content: ""; text-align: center;}
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
z-index: -1;
}
#content.index { header nav {margin-left: auto;
flex: 1; margin-right: auto;
} width: 90%;
display: flex;
align-items: center;
justify-content: space-between;}
footer { header nav a {color : white;
font-size: 15px; /* Taille de police réduite */ text-decoration: none;}
color: #ffffff;
text-align: center;
background-color: #000000e2;
padding: 5px 0; /* Padding réduit pour moins d'espace vertical */
margin-top: auto; /* Assure que le footer pousse vers le bas */
}
footer .licence p { footer{font-size: 23px;
margin: 5px 0; /* Réduit les marges des paragraphes */ text-align: right;}
}
footer .licence a { p.html{font-size: 30px;
color: #ffffff; margin-left: 2%;}
}
header {
font-size: 23px;
background-image: url(../img/ouiouibaguette.jpg);
padding: 10px 0;
text-align: center;
}
a.categorie{
margin-top: 1%;
margin-bottom: 1%;
border-radius: 30px;
background-color: #f2f2f2;
padding: 8px;}
header nav {
margin-left: auto;
margin-right: auto;
width: 90%;
display: flex;
align-items: center;
justify-content: space-between;
}
header nav a {
color : black;
text-decoration: none;
}
/*Pour la page index*/
/* index.php */ h1{text-align: center;
font-size: 100px;
font-family:monospace; }
h1.Hello { h2.nsi{text-align: center;
margin-top: 0%; font-family: cursive;
font-size: 50px; font-size: 170%;
text-align: center; margin-top: -1%}
color: white;
}
p.coco{ /*h3.nsi{font-size: 150%;
font-size: 145%; font-family: fantasy;
margin-top: 10%; color: #9A5315;}*/
margin-right: 15%;
margin-left: 48%; p.presentation{font-size: 165%;
line-height: 160%; margin-top: 85px;
color: #ffffff; margin-left: 11%;
} margin-right: 11%;
text-align: justify;}
div.licence{text-align: center;
font-size: 26px;}
/*Pour la page cours :*/
h1.cours{font-size: 60px;}
div.presentation{font-size: 20px;}
div.presentation a {color : #50468C;
text-decoration: none;
font-size: 17px}
div.presentation a.hdp {color : blue;
text-decoration: none;
font-size: 25px}
div.presentation td{text-align:center;}
div.presentation a.btn:hover{color: white;
background-color: #50468C;
transition: 0.3s all;}
/* Inscription et connextion */ /*Pour les pages projets et Cours :*/
div.error-message { table.nom{font-size: 25px}
color: red;
font-size: 60%;
}
.connexion { p.presentation1{margin-left: 5%;
width: 400px; margin-right: 5%;
height: 420px; text-align: justify;}
margin: 100px auto ; /* Augmenter la marge en haut à 100px */
padding: 40px;
background-color: #d4d4d4;
border: none;
border-radius: 50px;
text-align: center;
font-size: 140%;
}
.inscription {
width: 400px;
height: 950px;
margin: 100px auto ; /* Augmenter la marge en haut à 100px */
padding: 40px;
background-color: #d4d4d4;
border: none;
border-radius: 50px;
text-align: center;
font-size: 140%;
}
.commentaire {
width: 400px;
height: 900px;
margin: 100px auto ; /* Augmenter la marge en haut à 100px */
padding: 40px;
background-color: #d4d4d4;
border: none;
border-radius: 50px;
text-align: center;
font-size: 140%;
}
.event {
width: 400px;
height: 900px;
margin: 100px auto ; /* Augmenter la marge en haut à 100px */
padding: 40px;
background-color: #d4d4d4;
border: none;
border-radius: 50px;
text-align: center;
font-size: 140%;
}
.compteUser{
font-size: 70%;
}
.compteUser a{
color: #000000;
}
.submit {
font-size: 100%;
border-radius: 30px;
background-color: #0059ffe2;
border: none;
padding: 10px;
color: #ffffff;
}
/* profil*/
.page_profil {
width: 400px;
height: 900px;
margin: 100px auto ; /* Augmenter la marge en haut à 100px */
padding: 40px;
background-color: #d4d4d4;
border: none;
border-radius: 50px;
text-align: center;
font-size: 140%;
}
img.profil {
max-width : 15%;
}
/* evenement.php*/
.ListeEvenement {
width: auto;
height: auto;
margin: 100px auto ; /* Augmenter la marge en haut à 100px */
padding: 40px;
background-color: #d4d4d4;
border: none;
border-radius: 50px;
text-align: center;
font-size: 140%;
line-height: 170%;
color: #000000;
}
table.Event{
color: #000000;
text-decoration: none;
column-width: 60rem;
}

33
html/connexion.html Normal file
View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/style.css">
<title>Page de Connexion</title>
</head>
<body>
<div id="content_cours">
<header>
<nav>
<a href="../index.html">Page d'accueil</a>
</nav>
</header>
<h2>Connexion</h2>
<form action="../php/connexion.php" method="post">
<label for="login">Login :</label><br>
<input type="text" id="login" name="login"><br>
<label for="password">Mot de passe :</label><br>
<input type="password" id="password" name="password"><br>
<legend> Se souvenir de moi ? </legend>
<input type="checkbox" id="souvenirO" name="souvenirO">
<label for="souvenirO">OUI </label><br><br>
<input type="submit" value="Se connecter">
</form>
</body>
</html>

28
html/inscription.html Normal file
View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/style.css">
<title>Page d'Inscription</title>
</head>
<body>
<h2>Inscription</h2>
<form action="../php/inscription.php" method="post">
<label for="login">Login :</label><br>
<input type="text" id="login" name="login" required><br>
<label for="password">Mot de passe :</label><br>
<input type="password" id="password" name="password" required><br><br>
<label for="role">Role:</label>
<select id="role" name="role" required>
<option value="spectator">Spectator</option>
<option value="athlete">Athlete</option>
<option value="organizer">Organizer</option>
</select><br><br>
<input type="submit" value="S'inscrire">
</form>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

BIN
img/jo2024.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

41
index.html Executable file
View File

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/style.css">
<title>Site des Jeux Olympiques</title>
</head>
<body>
<div id="content index">
<header>
<h1 class="Hello">Bienvenue sur le site des JO !</h1><br>
<nav>
<a href="html/events.html">Évènements</a>
<a href="html/connexion.html">Connexion</a>
<a href="html/inscription.html">Inscription</a>
</nav>
</header>
<p style="margin-top:145px;">
<h1></h1>
</p>
<div class="licence">
<p style="margin-top:130px;"> Ces ressources sont publiées sous licence Creative Commons Attribution </p>
<a href="http://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank"><img alt="Licence CC Attribution" src="img/cc.png" /></a>
<p><strong>Auteur : </strong><a href="mailto:rafael.ghouar-toussaint@etu.u-pec.fr">Rafaël GHOUAR-TOUSSAINT</a></p>
<p><strong>Auteur : </strong><a href="mailto:alexis.hadjem-brancher@etu.u-pec.fr">Alexis Hadjem-Brancher</a></p>
<p><strong>Auteur : </strong><a href="mailto:nicolas1.laurent@etu.u-pec.fr">Nicolas Laurent</a></p>
</div>
</div>
<footer>
</footer>
</body>
</html>

View File

@ -1,59 +0,0 @@
<?php
session_start();
?>
<html lang="fr" >
<head>
<meta charset="utf-8">
<link rel="icon" href="img/jo2024.jpg" >
<link rel="stylesheet" href="css/style.css">
<title> Accueil - Jeux Olympiques</title>
</head>
<body>
<div id="content index">
<header>
<?php
if (isset($_SESSION['login'])) {
if ($_SESSION['genre']=='homme') {
echo "<h1 class='Hello'>Bienvenue Mr ". $_SESSION['nom']." ".$_SESSION['prenom']." sur le site des JO !</h1>";
}
if ($_SESSION['genre']=='femme') {
echo "<h1 class='Hello'>Bienvenue Mme ". $_SESSION['nom']." ".$_SESSION['prenom']." sur le site des JO !</h1>";
}
if($_SESSION['genre']=='autre') {
echo "<h1 class='Hello'>Bienvenue ". $_SESSION['nom']." ".$_SESSION['prenom']." sur le site des JO !</h1>";
}
echo "<nav>";
echo "<a href='php/evenement.php' class='categorie'>Évènements</a>";
echo "<a href='php/profil.php'><img class='profil' src='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/img/photo-profil.png' alt='profil'></a>";
echo "<a href='php/deconnexion.php' class='categorie'>Déconnexion</a>";
echo "</nav>";
}
else {
echo "<h1 class='Hello'>Bienvenue sur le site des JO ! </h1>";
echo "<nav>";
echo "<a href='php/evenement.php' class='categorie'>Évènements</a>";
echo "<a href='php/connexion.php' class='categorie'>Connexion</a>";
echo "<a href='php/inscription.php' class='categorie'>Inscription</a>";
echo "</nav>";
}
?>
</header>
<p class="coco"><b>Les Jeux Olympiques de Paris 2024 seront le plus grand événement jamais organisé en France. Ils se tiendront du 26 juillet au 11 août 2024, durant 16 jours hors du temps pendant lesquels Paris 2024 sera le cœur du monde. Les Jeux, cest du sport, mais tellement plus encore… Une combinaison de rendez-vous culturels, de programmation artistique, et de performances diverses qui créent une expérience unique en son genre. Les Jeux, cest un festival populaire et multiculturel qui sadresse au monde entier. Cest une aventure qui va embarquer la France entière pour une expérience inédite.</b></p>
</div>
<footer>
<?php require_once('php/footer.php'); ?>
</footer>
</body>
</html>

View File

@ -1,9 +0,0 @@
<?php
function initDatabase() {
$db = mysqli_connect("dwarves.iut-fbleau.fr","ghouar-t","Bases2023","ghouar-t");
if(!$db){
die("Connexion BD impossible.");
}
return $db;
}

View File

@ -1,76 +1,73 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<link rel="icon" href="../img/jo2024.jpg">
<link rel="stylesheet" href="../css/style.css">
<title>Connexion - Jeux Olympiques</title>
</head>
<body>
<?php <?php
// Informations de connexion à la base de données
require_once 'common.php'; require_once 'common.php';
session_start(); session_start();
if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
if (!empty($_POST['login']) && !empty($_POST['password'])) {
$db = initDatabase(); $db = initDatabase();
$login = htmlspecialchars($_POST['login'], ENT_QUOTES, 'UTF-8'); $login = $_POST['login'];
$password = htmlspecialchars($_POST['password'], ENT_QUOTES, 'UTF-8'); $password = $_POST['password'];
// Use prepared statements to prevent SQL injection
$stmt = $db->prepare("SELECT * FROM user WHERE login = ?");
$stmt->bind_param("s", $login);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) { $result=mysqli_query($db,"SELECT * FROM user WHERE login = '$login' ");
$row = $result->fetch_assoc();
if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
$hash = $row['mdp']; $hash = $row['mdp'];
$mail = $row['mail'];
$nom = $row['nom'];
$prenom = $row['prenom'];
$genre = $row['genre'];
$role = $row['Role'];
if (password_verify($password, $hash)) { if (password_verify($password, $hash)) {
$_SESSION['login'] = $login; if ($login) {
$_SESSION['mail'] = $mail; $_SESSION['login'] = $login;
$_SESSION['nom'] = $nom; header('Location: ../index.html');
$_SESSION['prenom'] = $prenom; exit();
$_SESSION['genre'] = $genre; }
$_SESSION['role'] = $role;
header('Location: ../index.php');
exit();
} else { } else {
$error_verif2 = "Mot de passe incorrect"; echo "Échec de la connexion : couple login/mot de passe invalide.";
} }
} else { } else {
$error_verif = "Ce login n'existe pas"; echo "Échec de la connexion : login invalide.";
}
$stmt->close();
} }
}
// Récupération des données du formulaire
?> ?>
<header>
<h1 class='Hello'>Page de connexion</h1>
<nav> <html lang="en">
<a href="../" class="categorie">Page d'accueil</a> <head>
</nav> <meta charset="utf-8">
</header> <link rel="stylesheet" href="../css/style.css">
<div class="connexion"> <title>Page de Connexion</title>
<u><i><h2>Connexion</h2></i></u><br> </head>
<form action="" method="post"> <body>
<label for="login">Login :</label><br>
<input type="text" id="login" name="login" required value="<?php if (isset($_POST['login'])) { echo htmlspecialchars($_POST['login'], ENT_QUOTES, 'UTF-8'); } ?>"><br> <div id="content_cours">
<?php if (isset($error_verif)) { echo "<div class='error-message'>$error_verif</div>"; } ?>
<br><br><label for="password">Mot de passe :</label><br> <header>
<input type="password" id="password" name="password" required placeholder="••••••••" value="<?php if (isset($_POST['password'])) { echo htmlspecialchars($_POST['password'], ENT_QUOTES, 'UTF-8'); } ?>"><br> <nav>
<?php if (isset($error_verif2)) { echo "<div class='error-message'>$error_verif2</div>"; } ?> <a href="../index.html">Page d'accueil</a>
<br><br><button type="submit" class="submit">Se connecter</button> </nav>
</form> </header>
<p class="compteUser">Vous ne possédez pas de compte ? <br><a href="inscription.php">Inscrivez-vous !</a></p>
</div>
<footer> <h2>Connexion</h2>
<?php require_once('footer.php'); ?>
</footer> <form action="" method="post">
<label for="login">Login :</label><br>
<input type="text" id="login" name="login" value="<?php if (isset($_REQUEST['login'])) { echo $_REQUEST['login']; } ?>"><br>
<label for="password">Mot de passe :</label><br>
<input type="password" id="password" name="password" value="<?php if (isset($_REQUEST['login'])) { echo $_REQUEST['login']; } ?>"><br>
<input type="submit" value="Se connecter">
</form>
</body> </body>
</html> </html>

View File

@ -1,100 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<link rel="icon" href="../img/jo2024.jpg">
<link rel="stylesheet" href="../css/style.css">
<title>Création évènement - Jeux Olympiques</title>
</head>
<body>
<?php
// Informations de connexion à la base de données
require_once 'common.php';
session_start();
$db = initDatabase();
if (!empty($_POST['nom'])) {
// Utiliser htmlspecialchars pour échapper les caractères spéciaux
$nom = htmlspecialchars($_POST['nom'], ENT_QUOTES, 'UTF-8');
$sport = htmlspecialchars($_POST['sport'], ENT_QUOTES, 'UTF-8');
$lieu = htmlspecialchars($_POST['lieu'], ENT_QUOTES, 'UTF-8');
$date = htmlspecialchars($_POST['date'], ENT_QUOTES, 'UTF-8');
$description = htmlspecialchars($_POST['description'], ENT_QUOTES, 'UTF-8');
// Récupérer le dernier ID et calculer le nouvel ID
$recupid = mysqli_query($db, "SELECT MAX(id) AS max_id FROM evenement");
$row = mysqli_fetch_assoc($recupid);
$id = $row['max_id'] + 1;
// Préparer la requête SQL
$stmt = mysqli_prepare($db, "INSERT INTO evenement (id, nom, sport, lieux, date, description, nbinscrit) VALUES (?, ?, ?, ?, ?, ?, ?)");
// Vérifier si la requête a été préparée avec succès
if ($stmt === false) {
die("Erreur de préparation de la requête : " . mysqli_error($db));
}
// Lier les paramètres à la requête préparée
$statut = 0; // Valeur par défaut pour le statut
mysqli_stmt_bind_param($stmt, 'isssssi', $id, $nom, $sport, $lieu, $date, $description, $statut);
// Exécuter la requête
if (mysqli_stmt_execute($stmt)) {
header('Location: evenement.php');
exit();
} else {
die("Erreur d'exécution de la requête : " . mysqli_stmt_error($stmt));
}
// Fermer la requête
mysqli_stmt_close($stmt);
}
// Fermer la connexion
mysqli_close($db);
?>
<header>
<h1 class='Hello'> Page de création d'évènement </h1>
<nav>
<?php
if (isset($_SESSION['login'])) {
echo "<a href='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/' class='categorie'>Page d'accueil</a>";
echo "<a href='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/php/profil.php'><img class='profil' src='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/img/photo-profil.png' alt='profil'></a>";
echo "<a href='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/php/.php' class='categorie'>Déconnexion</a>";
} else {
echo "<a href='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/' class='categorie'>Page d'accueil</a>";
echo "<a href='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/php/connexion.php' class='categorie'>Connexion</a>";
echo "<a href='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/php/inscription.php' class='categorie'>Inscription</a>";
}
?>
</nav>
</header>
<div class="inscription" id="inscription">
<u><i><h2>Création évènements</h2></i></u><br>
<form action="" method="post">
<label for="nom">Nom évènement :</label><br>
<input type="text" id="nom" name="nom" required><br><br>
<label for="sport">Sport :</label><br>
<input type="text" id="sport" name="sport" required><br><br>
<label for="lieu">Lieu :</label><br>
<input type="text" id="lieu" name="lieu" required><br><br>
<label for="date">Date :</label><br>
<input type="date" id="date" name="date" required><br><br>
<label for="description">Description :</label><br>
<input type="text" id="description" name="description" required><br><br>
<button type="submit" class="submit">Créer un évènement</button>
</form>
</div>
<footer>
<?php require_once('footer.php'); ?>
</footer>
</body>
</html>

View File

@ -1,84 +0,0 @@
<?php
require_once 'common.php';
session_start();
$db = initDatabase();
if (empty($_REQUEST['id_event'])) {
header('Location: evenement.php');
exit();
}
if (!empty($_GET['content'])) {
$content = htmlspecialchars($_GET['content'], ENT_QUOTES, 'UTF-8');
$id_event = intval($_GET['id_event']); // Ensure id_event is an integer
$login = $_SESSION['login']; // Assuming login is a string
if (empty($_GET['id_comment'])) { // new comment
// Use prepared statements for security
$recupid = mysqli_query($db, "SELECT MAX(id_comment) AS max_id FROM commentaire");
$row = mysqli_fetch_assoc($recupid);
$id = $row['max_id'] + 1;
$stmt = $db->prepare("INSERT INTO commentaire (id_comment, id_event, login, contenu) VALUES ($id,?, ?, ?)");
$stmt->bind_param('iss', $id_event, $login, $content);
} else { // update existing comment
$id_comment = intval($_GET['id_comment']); // Ensure id_comment is an integer
$stmt = $db->prepare("UPDATE commentaire SET contenu = ?, login = ? WHERE id_comment = ?");
$stmt->bind_param('ssi', $content, $login, $id_comment);
}
if ($stmt->execute()) {
header('Location: event.php?id=' . $id_event);
exit();
} else {
// Output SQL error for debugging
echo "Error: " . $stmt->error;
}
$stmt->close();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="icon" href="../img/jo2024.jpg">
<link rel="stylesheet" href="../css/style.css">
<title>Évènements - Jeux Olympiques</title>
</head>
<body>
<header>
<h1 class='Hello'>Évènement</h1>
<nav>
<?php
if (isset($_SESSION['login'])) {
echo "<a href='../' class='categorie'>Page d'accueil</a>";
echo "<a href='profil.php'><img class='profil' src='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/img/photo-profil.png' alt='profil'></a>";
echo "<a href='deconnexion.php' class='categorie'>Déconnexion</a>";
} else {
echo "<a href='../' class='categorie'>Page d'accueil</a>";
echo "<a href='connexion.php' class='categorie'>Connexion</a>";
echo "<a href='inscription.php' class='categorie'>Inscription</a>";
}
?>
</nav>
</header>
<div class="commentaire">
<u><i><h1>Ajouter/modifier un commentaire</h1></i></u>
<form action="" method="get">
<?php if (!empty($_GET['id_comment'])): ?>
<input name="id_comment" type="hidden" value="<?php echo htmlspecialchars($_GET['id_comment'], ENT_QUOTES, 'UTF-8'); ?>" />
<?php endif; ?>
<input name="id_event" type="hidden" value="<?php echo htmlspecialchars($_GET['id_event'], ENT_QUOTES, 'UTF-8'); ?>" />
<label>Commentaire<textarea name="content" cols="50" rows="6"></textarea></label>
<button type="submit" name="ok" value="1">Ajouter ce commentaire</button>
</form>
</div>
<footer>
<?php include 'footer.php'; ?>
</footer>
</body>
</html>

View File

@ -1,11 +0,0 @@
<?php
session_start();
session_destroy();
header("Location: ../index.php");
exit;
?>

View File

@ -1,123 +0,0 @@
<?php
// Informations de connexion à la base de données
require_once 'common.php';
session_start();
$db = initDatabase();
// Initialisation des événements si la table est vide
$event = "SELECT * FROM evenement";
if (mysqli_num_rows(mysqli_query($db, $event)) == 0) {
mysqli_query($db, "INSERT INTO evenement VALUES(1, 'Ceremonie d ouverture des JO','Cérémonie', 'Tour Eiffel', '2024-07-26', 'debut des JO', 0)");
mysqli_query($db, "INSERT INTO evenement VALUES(2, 'match d ouverture Football','Football', 'Stade des Princes', '2024-07-27', 'premier match de foot', 0)");
mysqli_query($db, "INSERT INTO evenement VALUES(3, 'course d ouverture','Natation', 'Piscine Olympique', '2024-07-27', 'premiere course', 0)");
$event = mysqli_query($db, "SELECT * FROM evenement");
}
// Construction de la requête dynamique
$query = "SELECT * FROM evenement WHERE 1=1";
$params = [];
$types = "";
if (!empty($_GET['sport'])) {
$query .= " AND Sport = ?";
$params[] = $_GET['sport'];
$types .= "s";
}
if (!empty($_GET['date'])) {
$query .= " AND Date = ?";
$params[] = $_GET['date'];
$types .= "s";
}
if (!empty($_GET['lieu'])) {
$query .= " AND Lieux = ?";
$params[] = $_GET['lieu'];
$types .= "s";
}
// Ajout de l'ordre de tri
$order_by = $_GET['order_by'] ?? 'Sport';
$order_dir = $_GET['order_dir'] ?? 'ASC';
$query .= " ORDER BY $order_by $order_dir";
// Préparation de la requête
$stmt = mysqli_prepare($db, $query);
if ($params) {
mysqli_stmt_bind_param($stmt, $types, ...$params);
}
mysqli_stmt_execute($stmt);
$event = mysqli_stmt_get_result($stmt);
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<link rel="icon" href="../img/jo2024.jpg">
<link rel="stylesheet" href="../css/style.css">
<title>Évènements - Jeux Olympiques</title>
</head>
<body>
<header>
<h1 class='Hello'>Liste des Évènements</h1>
<nav>
<?php
if (isset($_SESSION['login'])) {
echo " <a href='../' class='categorie'>Page d'accueil</a>";
echo " <a href='profil.php'><img class='profil' src='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/img/photo-profil.png' alt='profil'></a>";
echo "<a href='deconnexion.php' class='categorie'>Déconnexion</a>";
}
else {
echo "<a href='../' class='categorie'>Page d'accueil</a>";
echo "<a href='connexion.php' class='categorie'>Connexion</a>";
echo "<a href='inscription.php' class='categorie'>Inscription</a>";
}
?>
</nav>
</header>
<div class="ListeEvenement">
<div>
<h2>Liste des Évenements :</h2>
<form action="" method="GET">
<div>
<input name="sport" type="text" id="sport" placeholder="Chercher un sport ..." value="<?php echo htmlspecialchars($_GET['sport'] ?? '', ENT_QUOTES); ?>">
<input name="lieu" type="text" id="lieu" placeholder="Cherche par un lieu ..." value="<?php echo htmlspecialchars($_GET['lieu'] ?? '', ENT_QUOTES); ?>">
<input name="date" type="date" id="date" placeholder="Cherche par une date ..." value="<?php echo htmlspecialchars($_GET['date'] ?? '', ENT_QUOTES); ?>">
<button type="submit">Chercher</button>
</div>
</form>
</div>
<table class="Event">
<thead>
<tr>
<br><th scope="col"><a href="?order_by=Nom&order_dir=<?php echo $order_by == 'Nom' && $order_dir == 'ASC' ? 'DESC' : 'ASC'; ?>">Nom</a></th>
<th scope="col"><a href="?order_by=Sport&order_dir=<?php echo $order_by == 'Sport' && $order_dir == 'ASC' ? 'DESC' : 'ASC'; ?>">Sport</a></th>
<th scope="col"><a href="?order_by=Lieux&order_dir=<?php echo $order_by == 'Lieux' && $order_dir == 'ASC' ? 'DESC' : 'ASC'; ?>">Lieux de l'évènement</a></th>
<th scope="col"><a href="?order_by=Date&order_dir=<?php echo $order_by == 'Date' && $order_dir == 'ASC' ? 'DESC' : 'ASC'; ?>">Date</a></th>
<th scope="col"><a href="?order_by=NbInscrit&order_dir=<?php echo $order_by == 'NbInscrit' && $order_dir == 'ASC' ? 'DESC' : 'ASC'; ?>">Nombre de Participant</a></th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($event)) {
echo "<tr> <td scope='row'><a href='event.php?id=".$row['id']."'><br>".$row['Nom']."</td><td><br>".$row['Sport']."</td><td><br>".$row['Lieux']."</td><td><br>".$row['Date']."</td><td><br>".$row['NbInscrit']."</td></tr>";
}
?>
</tbody>
</table>
<?php
if (isset($_SESSION['role'])) {
if ($_SESSION['role']=='organizer') {
echo "<br><a href='creer_event.php' class='categorie'>Créer un évènement</a>";
}
}
?>
</div>
<footer>
<?php require_once('footer.php'); ?>
</footer>
</body>
</html>

View File

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

View File

@ -1,12 +0,0 @@
<div class="licence">
<p>Ces ressources sont publiées sous licence Creative Commons Attribution</p>
<a href="http://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">
<img alt="Licence CC Attribution" src="https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/img/cc.png" >
</a>
<p>
<strong>Site SAE 2.2 réalisé par : </strong>
<a href="mailto:rafael.ghouar-toussaint@etu.u-pec.fr">Rafaël Ghouar-Toussaint</a> -
<a href="mailto:alexis.hadjem-brancher@etu.u-pec.fr">Alexis Hadjem-Brancher</a> -
<a href="mailto:nicolas1.laurent@etu.u-pec.fr">Nicolas Laurent</a>
</p><br>
</div>

View File

@ -1,59 +0,0 @@
<?php
session_start();
?>
<html lang="fr" >
<head>
<meta charset="utf-8">
<link rel="icon" href="img/jo2024.jpg" >
<link rel="stylesheet" href="css/style.css">
<title> Accueil - Jeux Olympiques</title>
</head>
<body>
<div id="content index">
<header>
<?php
if (isset($_SESSION['login'])) {
if ($_SESSION['genre']=='homme') {
echo "<h1 class='Hello'>Bienvenue Mr ". $_SESSION['nom']." ".$_SESSION['prenom']." sur le site des JO !</h1>";
}
if ($_SESSION['genre']=='femme') {
echo "<h1 class='Hello'>Bienvenue Mme ". $_SESSION['nom']." ".$_SESSION['prenom']." sur le site des JO !</h1>";
}
if($_SESSION['genre']=='autre') {
echo "<h1 class='Hello'>Bienvenue ". $_SESSION['nom']." ".$_SESSION['prenom']." sur le site des JO !</h1>";
}
echo "<nav>";
echo "<a href='php/evenement.php' class='categorie'>Évènements</a>";
echo "<a href='php/profil.php'><img class='profil' src='https://dwarves.iut-fbleau.fr/~ghouar-t/SaeDEV2.2/img/photo-profil.png' alt='profil'></a>";
echo "<a href='php/deconnexion.php' class='categorie'>Déconnexion</a>";
echo "</nav>";
}
else {
echo "<h1 class='Hello'>Bienvenue sur le site des JO ! </h1>";
echo "<nav>";
echo "<a href='php/evenement.php' class='categorie'>Évènements</a>";
echo "<a href='php/connexion.php' class='categorie'>Connexion</a>";
echo "<a href='php/inscription.php' class='categorie'>Inscription</a>";
echo "</nav>";
}
?>
</header>
<p class="coco"><b>Les Jeux Olympiques de Paris 2024 seront le plus grand événement jamais organisé en France. Ils se tiendront du 26 juillet au 11 août 2024, durant 16 jours hors du temps pendant lesquels Paris 2024 sera le cœur du monde. Les Jeux, cest du sport, mais tellement plus encore… Une combinaison de rendez-vous culturels, de programmation artistique, et de performances diverses qui créent une expérience unique en son genre. Les Jeux, cest un festival populaire et multiculturel qui sadresse au monde entier. Cest une aventure qui va embarquer la France entière pour une expérience inédite.</b></p>
</div>
<footer>
<?php require_once('php/footer.php'); ?>
</footer>
</body>
</html>

View File

@ -1,105 +1,32 @@
<?php <?php
require_once 'common.php';
session_start();
$db = initDatabase(); // Informations de connexion à la base de données
$db = mysqli_connect("dwarves.iut-fbleau.fr","ghouar-t","Bases2023","ghouar-t");
// Populate initial data if table is empty if(!$db){
$vide = mysqli_query($db, "SELECT * FROM user"); die("Connexion BD impossible.");
if (mysqli_num_rows($vide) == 0) { }else{
$hello = password_hash('hello', PASSWORD_DEFAULT); echo "Connexion BD reussie ! <br>";
mysqli_query($db, "INSERT INTO user (login, email, last_name, first_name, gender, password, role) VALUES ('toto','toto@gmail.com','Dufour','Michel','homme','$hello','athlete')");
mysqli_query($db, "INSERT INTO user (login, email, last_name, first_name, gender, password, role) VALUES ('commun','commun@gmail.com','Hello','World','autre','$hello','organizer')");
mysqli_query($db, "INSERT INTO user (login, email, last_name, first_name, gender, password, role) VALUES ('Marie','Marie@gmail.com','Monro','Mariline','femme','$hello','spectator')");
} }
if (!empty($_POST['login']) && !empty($_POST['password'])) { // Récupération des données du formulaire
$login = htmlspecialchars($_POST['login'], ENT_QUOTES, 'UTF-8'); $login = $_POST['login'];
$password = htmlspecialchars($_POST['password'], ENT_QUOTES, 'UTF-8'); $password = $_POST['password'];
$role = htmlspecialchars($_POST['role'], ENT_QUOTES, 'UTF-8'); $role = $_POST['role'];
$mail = htmlspecialchars($_POST['mail'], ENT_QUOTES, 'UTF-8');
$nom = htmlspecialchars($_POST['nom'], ENT_QUOTES, 'UTF-8');
$prenom = htmlspecialchars($_POST['prenom'], ENT_QUOTES, 'UTF-8');
$genre = htmlspecialchars($_POST['genre'], ENT_QUOTES, 'UTF-8');
$password_hash = password_hash($password, PASSWORD_DEFAULT);
// Check for existing user with same login or email
$stmt = $db->prepare("SELECT * FROM user WHERE login = ? OR mail = ?");
$stmt->bind_param("ss", $login, $mail);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows == 0) { /*$stmt = mysqli_prepare($db,
$stmt = $db->prepare("INSERT INTO user (login, mail, nom, prenom, genre, mdp, Role) VALUES (?, ?, ?, ?, ?, ?, ?)"); "INSERT INTO user (login, mdp)
$stmt->bind_param("sssssss", $login, $mail, $nom, $prenom, $genre, $password_hash, $role); VALUES (?,?)");*/
if ($stmt->execute()) { $password_hash = password_hash($password, PASSWORD_DEFAULT);
header('Location: connexion.php');
exit(); $query_insert = "INSERT INTO user (login, mdp, Role) VALUES ('$login', '$password_hash','$role')";
} else {
die("Erreur : " . $stmt->error); if (mysqli_query($db, $query_insert)) {
} echo "Inscription réussie !";
} else { } else {
$existant = $result->fetch_assoc(); echo "Erreur lors de l'inscription : " . mysqli_error($db);
if ($existant['login'] == $login) {
$error_verif = "Ce login est déjà utilisé";
} else if ($existant['mail'] == $mail) {
$error_verif2 = "Cette adresse mail est déjà utilisée";
}
}
$stmt->close();
} }
mysqli_close($db);
?> ?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<link rel="icon" href="../img/jo2024.jpg">
<link rel="stylesheet" href="../css/style.css">
<title>Inscription - Jeux Olympiques</title>
</head>
<body>
<header>
<h1 class='Hello'>Page d'inscription</h1>
<nav>
<a href="../" class="categorie">Page d'accueil</a>
</nav>
</header>
<div class="inscription" id="inscription">
<u><i><h2>Inscription</h2></i></u> <br>
<form action="" method="post">
<label for="login">Login :</label><br>
<input type="text" id="login" name="login" required><br>
<?php if (isset($error_verif)) {echo "<div class='error-message'>$error_verif</div>";} ?>
<br><br><label for="mail">Adresse mail :</label><br>
<input type="email" id="mail" name="mail" placeholder="username@example.com" required><br>
<?php if (isset($error_verif2)) {echo "<div class='error-message'>$error_verif2</div>";} ?>
<br><br><label for="nom">Nom :</label><br>
<input type="text" id="nom" name="nom" required><br>
<br><br><label for="prenom">Prenom :</label><br>
<input type="text" id="prenom" name="prenom" required><br>
<br><br> <label for="genre"> Genre: </label> <br>
<select id="genre" name="genre" required>
<option value="">-- Please choose an option --</option>
<option value="homme">Homme</option>
<option value="femme">Femme</option>
<option value="autre">Autre</option>
</select><br>
<br><br><label for="password">Mot de passe :</label><br>
<input type="password" id="password" name="password" placeholder="••••••••" required><br>
<br><br><label for="role">Role :</label><br>
<select id="role" name="role" required>
<option value="">-- Please choose an option --</option>
<option value="spectator">Spectator</option>
<option value="athlete">Athlete</option>
<option value="organizer">Organizer</option>
</select><br><br>
<br><button type="submit" class="submit">Créer un compte</button>
</form>
<p class="compteUser">Vous possédez déjà un compte ? <br><a href="connexion.php">Connectez-vous !</a></p>
</div>
<footer>
<?php require_once('footer.php'); ?>
</footer>
</body>
</html>

View File

@ -1,142 +0,0 @@
<?php
require_once('common.php');
session_start();
$login = $_SESSION['login'];
$mail = $_SESSION['mail'];
$nom = $_SESSION['nom'];
$prenom = $_SESSION['prenom'];
$genre = $_SESSION['genre'];
$role = $_SESSION['role'];
if (!empty($_POST['nom']) && !empty($_POST['mail']) && !empty($_POST['prenom']) && !empty($_POST['genre'])) {
$db = initDatabase();
$mail = $_POST['mail'];
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$genre = $_POST['genre'];
$originalmail = $_SESSION['mail'];
if ($mail != $originalmail) {
$verif=mysqli_query($db,"SELECT * FROM user WHERE mail = '$mail' ");
if (mysqli_num_rows($verif) == 0) {
$bool=true;
}
else {
$bool=false;
}
}
else {
$bool=true;
}
$result = "UPDATE user SET mail='$mail',nom='$nom', prenom='$prenom', genre='$genre' WHERE login = '$login' AND mail = '$originalmail'";
if ($bool==true) {
if (mysqli_query($db,$result)) {
$_SESSION['login'] = $login;
$_SESSION['mail'] = $mail;
$_SESSION['nom'] = $nom;
$_SESSION['prenom'] = $prenom;
$_SESSION['genre'] = $genre;
$_SESSION['role'] = $role;
header('Location: ../index.php');
exit();
}
else {
die("erreur");
}
}
else {
$error_verif = "cette adresse mail est déjà utilisé";
$mail=$originalmail;
}
}
?>
<html lang="fr">
<head>
<meta charset="utf-8">
<link rel="icon" href="../img/jo2024.jpg" >
<link rel="stylesheet" href="../css/style.css">
<title> Profil - Jeux Olympiques</title>
</head>
<body>
<header>
<h1 class='Hello'> Gestion du Profil </h1>
<nav>
<a href="../" class="categorie">Page d'accueil</a>
<a href='evenement.php' class='categorie'>Évènements</a>
<a href='deconnexion.php' class='categorie'>Déconnexion</a>
</nav>
</header>
<div class="page_profil">
<img class="profil" src="../img/photo-profil.png" alt="profil">
<form action="" method="post">
<br><label for="login">Login :</label><br>
<?php
echo $login;
?>
<br><br><label for="mail">Adresse mail :</label><br>
<input type="email" id="mail" name="mail" value="<?php if (isset($mail)) {echo $mail;} ?>"><br>
<?php if (isset($error_verif)) {echo "<div class='error-message'>$error_verif</div>";} ?>
<br><label for="nom">Nom :</label><br>
<input type="text" id="nom" name="nom" required value="<?php if (isset($nom)) {echo $nom;} ?>"><br>
<br><label for="prenom">Prenom :</label><br>
<input type="text" id="prenom" name="prenom" value="<?php if (isset($prenom)) {echo $prenom;} ?>"><br>
<br><label for="genre">Genre :</label><br>
<select id="genre" name="genre" value="<?php $genre; ?>" required>
<?php
if ($genre=="homme") {
echo "<option value='homme' selected>Homme</option>";
echo "<option value='femme'>Femme</option>";
echo "<option value='autre'>Autre</option>";
}
if ($genre=="femme") {
echo "<option value='homme'>Homme</option>";
echo "<option value='femme' selected>Femme</option>";
echo "<option value='autre'>Autre</option>";
}
if ($genre=="autre") {
echo "<option value='homme'>Homme</option>";
echo "<option value='femme'>Femme</option>";
echo "<option value='autre' selected>Autre</option>";
}
?>
</select><br><br>
<label for="role">Role :</label><br>
<?php
echo $role;
?>
</select><br><br>
<br><button type="submit" class="submit">Modifier les informations personnelles </button>
</form>
</div>
<footer>
<?php require_once('footer.php'); ?>
</footer>
</body>
</html>

4
rapport.txt Normal file
View File

@ -0,0 +1,4 @@
Sae WEB
Rafael a commencé par récupéré la base de certain projet ultérieur à ce projet comme base, qui sont:
-un projet de NSI pour la page d'acceuil