travail en colab avec alexis et nicolas sur un partage

This commit is contained in:
Ghouar-Toussaint Rafael 2024-06-15 17:47:50 +02:00
parent a6f0b4d1ad
commit c7ce5dd3ac
9 changed files with 259 additions and 72 deletions

View File

@ -1,4 +1,9 @@
/*Pour toutes les pages : */
@font-face {
font-family: "RobotoFlex";
src: url(/assets/RobotoFlex.ttf);
font-display: swap;
}
html, body {
height: 100%;
@ -8,11 +13,26 @@
body {
display: flex;
flex-direction: column;
min-height: auto; /* Utilisez 100vh pour une hauteur complète de la fenêtre */
min-height: 100dvh; /* Utilisez 100vh pour une hauteur complète de la fenêtre */
background-image: url(../img/jo20244.jpeg);
background-size: cover;
overflow-x: hidden;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
font-family: "RobotoFlex";
}
body::before{
content: "";
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
z-index: -1;}
#content.index {
flex: 1;
}
@ -39,7 +59,6 @@
background-image: url(../img/ouiouibaguette.jpg);
padding: 10px 0;
text-align: center;
/*background-color: #000000e2;*/
}
a.categorie{
@ -90,11 +109,12 @@
div.error-message {
color: red;
font-size: 60%;
}
.connexion {
width: 400px;
height: 400px;
height: 420px;
margin: 100px auto ; /* Augmenter la marge en haut à 100px */
padding: 40px;
background-color: #d4d4d4;
@ -106,7 +126,7 @@
.inscription {
width: 400px;
height: 580px;
height: 900px;
margin: 100px auto ; /* Augmenter la marge en haut à 100px */
padding: 40px;
background-color: #d4d4d4;
@ -126,12 +146,17 @@
.submit {
font-size: 100%;
border-radius: 30px;
background-color: #0059ffe2;
border: none;
padding: 10px;
color: #ffffff;
}
/* profil*/
.page_profil {
width: 400px;
height: 400px;
height: 900px;
margin: 100px auto ; /* Augmenter la marge en haut à 100px */
padding: 40px;
background-color: #d4d4d4;
@ -144,3 +169,19 @@
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%;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 431 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 KiB

View File

@ -18,10 +18,18 @@ session_start();
<header>
<?php
if (isset($_SESSION['login'])) {
echo "<h1 class='Hello'>Bienvenue ". $_SESSION['login']." sur le site des JO !</h1>";
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='html/events.html' class='categorie'>Évènements</a>";
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>";
@ -30,7 +38,7 @@ session_start();
echo "<h1 class='Hello'>Bienvenue sur le site des JO ! </h1>";
echo "<nav>";
echo "<a href='html/events.html' class='categorie'>Évènements</a>";
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>";

View File

@ -28,12 +28,18 @@ if (!empty($_POST['login']) && !empty($_POST['password'])) {
$row = mysqli_fetch_assoc($result);
$hash = $row['mdp'];
$mail = $row['mail'];
$nom = $row['nom'];
$prenom = $row['prenom'];
$genre = $row['genre'];
$role = $row ['Role'];
if (password_verify($password, $hash)) {
if ($login) {
$_SESSION['login'] = $login;
$_SESSION['mail'] = $mail;
$_SESSION['nom'] = $nom;
$_SESSION['prenom'] = $prenom;
$_SESSION['genre'] = $genre;
$_SESSION['role'] = $role;
header('Location: ../index.php');
@ -42,10 +48,10 @@ if (!empty($_POST['login']) && !empty($_POST['password'])) {
} else {
$error_verif2 = "mauvais mot de passe";
$error_verif2 = "Mot de passe incorrect";
}
} else {
$error_verif = "ce login n'existe pas";
$error_verif = "Ce login n'existe pas";
}
@ -62,7 +68,7 @@ if (!empty($_POST['login']) && !empty($_POST['password'])) {
<header>
<h1 class='Hello'> Page de connexion </h1>
<nav>
<a href="../index.php" class="categorie">Page d'accueil</a>
<a href="../" class="categorie">Page d'accueil</a>
</nav>
</header>

75
php/evenement.php Normal file

File diff suppressed because one or more lines are too long

View File

@ -13,17 +13,29 @@
// Informations de connexion à la base de données
require_once 'common.php';
session_start();
$db = initDatabase();
$vide = mysqli_query($db,"SELECT * FROM user");
if (mysqli_num_rows($vide)==0) {
$hello=password_hash('hello', PASSWORD_DEFAULT);
mysqli_query($db,"INSERT INTO user VALUES ('toto','toto@gmail.com','Dufour','Michel','homme','$hello','athlete')");
mysqli_query($db,"INSERT INTO user VALUES ('commun','commun@gmail.com','Hello','World','autre','$hello','organizer')");
mysqli_query($db,"INSERT INTO user VALUES ('Marie','Marie@gmail.com','Monro','Mariline','femme','$hello','spectator')");
}
if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
$db = initDatabase();
$login = $_POST['login'];
$password = $_POST['password'];
$role = $_POST['role'];
$mail = $_POST['mail'];
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$genre = $_POST['genre'];
$password_hash = password_hash($password, PASSWORD_DEFAULT);
$verif=mysqli_query($db,"SELECT * FROM user WHERE login = '$login' ");
$verif2=mysqli_query($db,"SELECT * FROM user WHERE mail = '$mail' ");
$result="INSERT INTO user VALUES('$login','$mail','$password_hash','$role')";
$result="INSERT INTO user VALUES('$login','$mail','$nom','$prenom','$genre','$password_hash','$role')";
if (mysqli_num_rows($verif) == 0) {
if (mysqli_num_rows($verif2) == 0) {
@ -37,11 +49,11 @@ if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
}
}
else {
$error_verif2 = "cette adresse mail est déjà utilisé";
$error_verif2 = "Cette adresse mail est déjà utilisé";
}
}
else {
$error_verif = "ce login est déjà utilisé";
$error_verif = "Ce login est déjà utilisé";
}
@ -59,7 +71,7 @@ if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
<header>
<h1 class='Hello'> Page d'inscription </h1>
<nav>
<a href="../index.php" class="categorie">Page d'accueil</a>
<a href="../" class="categorie">Page d'accueil</a>
</nav>
</header>
@ -71,14 +83,29 @@ if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
<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>
<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" value="<?php if (isset($_REQUEST['mail'])) { echo $_REQUEST['mail']; } ?>" required><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="••••••••" value="<?php if (isset($_REQUEST['password'])) { echo $_REQUEST['password']; } ?>" required><br>
<input type="password" id="password" name="password" placeholder="••••••••" required><br>
<br><br><label for="role">Role :</label><br>

View File

@ -4,28 +4,45 @@ session_start();
$login = $_SESSION['login'];
$mail = $_SESSION['mail'];
$nom = $_SESSION['nom'];
$prenom = $_SESSION['prenom'];
$genre = $_SESSION['genre'];
$role = $_SESSION['role'];
if (!empty($_POST['login']) && !empty($_POST['mail'])) {
if (!empty($_POST['nom']) && !empty($_POST['mail']) && !empty($_POST['prenom']) && !empty($_POST['genre'])) {
$db = initDatabase();
$login = $_POST['login'];
$mail = $_POST['mail'];
$role = $_POST['role'];
$originallogin = $_SESSION['login'];
$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;
}
$verif=mysqli_query($db,"SELECT * FROM user WHERE login = '$login' ");
$verif2=mysqli_query($db,"SELECT * FROM user WHERE mail = '$mail' ");
$result = "UPDATE user SET login='$login', mail='$mail',Role='$role' WHERE login = '$originallogin' AND mail = '$originalmail'";
$result = "UPDATE user SET mail='$mail',nom='$nom', prenom='$prenom', genre='$genre' WHERE login = '$login' AND mail = '$originalmail'";
//if (mysqli_num_rows($verif) == 0) {
//if (mysqli_num_rows($verif2) == 0) {
if ($bool==true) {
if (mysqli_query($db,$result)) {
$_SESSION['login']=$login;
$_SESSION['role']=$role;
$_SESSION['mail']=$mail;
$_SESSION['login'] = $login;
$_SESSION['mail'] = $mail;
$_SESSION['nom'] = $nom;
$_SESSION['prenom'] = $prenom;
$_SESSION['genre'] = $genre;
$_SESSION['role'] = $role;
header('Location: ../index.php');
exit();
@ -34,18 +51,18 @@ if (!empty($_POST['login']) && !empty($_POST['mail'])) {
die("erreur");
}
}
//else {
//$error_verif2 = "cette adresse mail est déjà utilisé";
//}
//}
//else {
//$error_verif = "ce login est déjà utilisé";
//}
//}
else {
$error_verif = "cette adresse mail est déjà utilisé";
$mail=$originalmail;
}
}
?>
<html lang="fr">
<head>
<script language="javascript" src="JavaScript/déconnexion.js"></script>
<meta charset="utf-8">
<link rel="icon" href="../img/jo2024.jpg" >
<link rel="stylesheet" href="../css/style.css">
@ -59,8 +76,8 @@ if (!empty($_POST['login']) && !empty($_POST['mail'])) {
<nav>
<a href="../index.php" class="categorie">Page d'accueil</a>
<a href='events.php' class='categorie'>Évènements</a>
<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>
@ -73,30 +90,43 @@ if (!empty($_POST['login']) && !empty($_POST['mail'])) {
<form action="" method="post">
<br><label for="login">Login :</label><br>
<input type="text" id="login" name="login" required value="<?php if (isset($login)) {echo $login;} ?>"><br>
<br><label for="password">Adresse mail :</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>
<br><label for="role">Role :</label><br>
<select id="role" name="role" value="<?php $role; ?>" required>
<?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 ($role=="spectator") {
echo "<option value='spectator' selected>Spectator</option>";
echo "<option value='athlete'>Athlete</option>";
echo "<option value='organizer'>Organizer</option>";
if ($genre=="homme") {
echo "<option value='homme' selected>Homme</option>";
echo "<option value='femme'>Femme</option>";
echo "<option value='autre'>Autre</option>";
}
if ($role=="athlete") {
echo "<option value='spectator'>Spectator</option>";
echo "<option value='athlete' selected>Athlete</option>";
echo "<option value='organizer'>Organizer</option>";
if ($genre=="femme") {
echo "<option value='homme'>Homme</option>";
echo "<option value='femme' selected>Femme</option>";
echo "<option value='autre'>Autre</option>";
}
if ($role=="organizer") {
echo "<option value='spectator'>Spectator</option>";
echo "<option value='athlete'>Athlete</option>";
echo "<option value='organizer' selected>Organizer</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>