travail en colab avec alexis et nicolas sur un partage

This commit is contained in:
Ghouar-Toussaint Rafael 2024-06-14 18:42:40 +02:00
parent 69593daeec
commit 30b39fcdb5
11 changed files with 262 additions and 89 deletions

View File

@ -8,9 +8,11 @@
body {
display: flex;
flex-direction: column;
min-height: 100%;
min-height: 120vh; /* Utilisez 100vh pour une hauteur complète de la fenêtre */
background-image: url(../img/jo20244.jpeg);
}
#content.index {
flex: 1;
}
@ -37,12 +39,15 @@
background-image: url(../img/ouiouibaguette.jpg);
padding: 10px 0;
text-align: center;
/*background-color: #000000e2;*/
}
a.categorie{
margin-top: 1%;
margin-bottom: 1%;
border-radius: 30px;
background-color: #FFFF;
padding: 6px;}
background-color: #f2f2f2;
padding: 8px;}
header nav {
margin-left: auto;
@ -63,29 +68,79 @@
/* index.php */
h1.Hello {
margin-top: 0%;
font-size: 50px;
text-align: center;
color: white;
}
p.coco{
font-size: 125%;
margin-top: 75px;
margin-right: 30%;
margin-left: 5%;
line-height: 135%;
font-size: 145%;
margin-top: 10%;
margin-right: 15%;
margin-left: 48%;
line-height: 160%;
color: #ffffff;
}
.content_cours {
/* Inscription et connextion */
div.error-message {
color: red;
}
.connexion {
width: 400px;
height: 400px;
margin: 100px auto ; /* Augmenter la marge en haut à 100px */
padding: 40px;
background-color: #f2f2f2;
border: 5px solid #ccc;
border-radius: 90px;
background-color: #d4d4d4;
border: none;
border-radius: 50px;
text-align: center;
font-size: 130%;
font-size: 140%;
}
.inscription {
width: 400px;
height: 550px;
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%;
}
/* profil*/
.page_profil {
width: 400px;
height: 400px;
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%;
}

BIN
img/essai.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 KiB

BIN
img/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
img/jo20244.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

BIN
img/jo20244.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 KiB

BIN
img/photo-profil.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -3,9 +3,9 @@ session_start();
?>
<html lang="fr">
<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">
@ -18,16 +18,16 @@ session_start();
<header>
<?php
if (isset($_SESSION['login'])) {
echo "<h1 class='Hello'>Bienvenue ". $_SESSION['login']." sur le site des JO !</h1><br>";
echo "<h1 class='Hello'>Bienvenue ". $_SESSION['login']." sur le site des JO !</h1>";
echo "<nav>";
echo "<a href='html/events.html' 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><br>";
echo "<h1 class='Hello'>Bienvenue sur le site des JO ! </h1>";
echo "<nav>";
echo "<a href='html/events.html' class='categorie'>Évènements</a>";
@ -44,20 +44,8 @@ session_start();
</div>
<footer>
<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="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>
<footer>
<?php require_once('php/footer.php'); ?>
</footer>
</body>
</html>

View File

@ -1,4 +1,4 @@
<html lang="fr">
<html lang="fr" >
<head>
<meta charset="utf-8">
<link rel="icon" href="../img/jo2024.jpg" >
@ -14,10 +14,11 @@
// Informations de connexion à la base de données
require_once 'common.php';
session_start();
if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
if (!empty($_POST['login']) && !empty($_POST['password'])) {
$db = initDatabase();
$login = $_POST['login'];
$password = $_POST['password'];
$result=mysqli_query($db,"SELECT * FROM user WHERE login = '$login' ");
@ -26,21 +27,25 @@ if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
$row = mysqli_fetch_assoc($result);
$hash = $row['mdp'];
$mail = $row['mail'];
$role = $row ['Role'];
if (password_verify($password, $hash)) {
if ($login) {
$_SESSION['login'] = $login;
$_SESSION['mail'] = $mail;
$_SESSION['role'] = $role;
header('Location: ../index.php');
exit();
}
} else {
echo "Échec de la connexion : couple login/mot de passe invalide.";
$error_verif2 = "mauvais mot de passe";
}
} else {
echo "Échec de la connexion : login inconnu.";
$error_verif = "ce login n'existe pas";
}
@ -55,40 +60,34 @@ if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
<header>
<h1 class='Hello'> Page de connexion </h1>
<nav>
<a href="../index.php" class="categorie">Page d'accueil</a>
</nav>
</header>
<div class="content_cours">
<div class="connexion">
<h2>Connexion</h2><br>
<u><i><h2>Connexion</h2></i></u><br>
<form action="" method="post">
<label for="login">Login :</label><br>
<input type="text" id="login" name="login" required value="<?php if (isset($_REQUEST['login'])) { echo $_REQUEST['login']; } ?>"><br>
<br><label for="password">Mot de passe :</label><br>
<input type="password" id="password" name="password" required placeholder="••••••••" value="<?php if (isset($_REQUEST['login'])) { echo $_REQUEST['login']; } ?>"><br>
<br><input type="submit" value="Se connecter">
</form>
<?php if (isset($error_verif)) {echo "<div class='error-message'>$error_verif</div>";} ?>
<br><br><label for="password">Mot de passe :</label><br>
<input type="password" id="password" name="password" required placeholder="••••••••" value="<?php if (isset($_REQUEST['password'])) { echo $_REQUEST['password']; } ?>"><br>
<?php if (isset($error_verif2)) {echo "<div class='error-message'>$error_verif2</div>";} ?>
<br><br><button type="submit" class="submit">Se connecter </button>
</form>
<p class="compteUser">Vous ne possédez pas de compte ? <br><a href="inscription.php">Inscrivez-vous !</a></p>
</div>
<footer>
<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="../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>
<?php require_once('footer.php'); ?>
</footer>
</body>
</html>

12
php/footer.php Normal file
View File

@ -0,0 +1,12 @@
<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,11 +1,11 @@
<html lang="fr">
<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>
<body >
<?php
@ -18,25 +18,32 @@ if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
$login = $_POST['login'];
$password = $_POST['password'];
$role = $_POST['role'];
$mail = $_POST['mail'];
$password_hash = password_hash($password, PASSWORD_DEFAULT);
$verif=mysqli_query($db,"SELECT * FROM user WHERE login = '$login' ");
$result="INSERT INTO user VALUES('$login','$password_hash','$role')";
$verif2=mysqli_query($db,"SELECT * FROM user WHERE mail = '$mail' ");
$result="INSERT INTO user VALUES('$login','$mail','$password_hash','$role')";
if (mysqli_num_rows($verif) == 0) {
if (mysqli_query($db,$result)) {
if (mysqli_num_rows($verif2) == 0) {
if (mysqli_query($db,$result)) {
header('Location: connexion.php');
exit();
header('Location: connexion.php');
exit();
}
else {
die("erreur");
}
}
else {
die("erreur");
$error_verif2 = "cette adresse mail est déjà utilisé";
}
}
else {
echo 'login déjà utilisé';
header('Location: inscription.php');
echo 'login déjà utilisé';
$error_verif = "ce login est déjà utilisé";
}
}
@ -50,45 +57,45 @@ if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
<header>
<nav>
<h1 class='Hello'> Page d'inscription </h1>
<nav>
<a href="../index.php" class="categorie">Page d'accueil</a>
</nav>
</header>
<div class="content_cours">
<div class="inscription" id="inscription">
<h2>Inscription</h2> <br>
<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" value="<?php if (isset($_REQUEST['login'])) { echo $_REQUEST['login']; } ?>"><br>
<br><label for="password">Mot de passe :</label><br>
<input type="password" id="password" name="password" required placeholder="••••••••" value="<?php if (isset($_REQUEST['login'])) { echo $_REQUEST['login']; } ?>"><br>
<br><label for="role">Role :</label>
<input type="text" id="login" name="login" value="<?php if (isset($_REQUEST['login'])) { echo $_REQUEST['login']; } ?>" ><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>
<?php if (isset($error_verif2)) {echo "<div class='error-message'>$error_verif2</div>";} ?>
<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>
<br><br><label for="role">Role :</label><br>
<select id="role" name="role" required>
<option value="spectator">Spectator</option>
<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>
<input type="submit" value="Se connecter">
<br><button type="submit" class="submit">Créer une compte </button>
</form>
<p class="compteUser">Vous possédez déjà un compte ? <br><a href="connexion.php">Connectez-vous !</a></p>
</div>
<footer>
<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="../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>
<?php require_once('footer.php'); ?>
</footer>
</body>

112
php/profil.php Normal file
View File

@ -0,0 +1,112 @@
<?php
require_once('common.php');
session_start();
$login = $_SESSION['login'];
$mail = $_SESSION['mail'];
$role = $_SESSION['role'];
if (!empty($_POST['login']) && !empty($_POST['mail'])) {
$db = initDatabase();
$login = $_POST['login'];
$mail = $_POST['mail'];
$role = $_POST['role'];
$originallogin = $_SESSION['login'];
$originalmail = $_SESSION['mail'];
$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'";
//if (mysqli_num_rows($verif) == 0) {
//if (mysqli_num_rows($verif2) == 0) {
if (mysqli_query($db,$result)) {
$_SESSION['login']=$login;
$_SESSION['role']=$role;
$_SESSION['mail']=$mail;
header('Location: ../index.php');
exit();
}
else {
die("erreur");
}
}
//else {
//$error_verif2 = "cette adresse mail est déjà utilisé";
//}
//}
//else {
//$error_verif = "ce login est déjà utilisé";
//}
//}
?>
<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">
<title> Profil - Jeux Olympiques</title>
</head>
<body>
<header>
<h1 class='Hello'> Gestion du Profil </h1>
<nav>
<a href="../index.php" class="categorie">Page d'accueil</a>
<a href='events.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>
<input type="text" id="login" name="login" required value="<?php if (isset($login)) {echo $login;} ?>"><br>
<br><label for="password">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 ($role=="spectator") {
echo "<option value='spectator' selected>Spectator</option>";
echo "<option value='athlete'>Athlete</option>";
echo "<option value='organizer'>Organizer</option>";
}
if ($role=="athlete") {
echo "<option value='spectator'>Spectator</option>";
echo "<option value='athlete' selected>Athlete</option>";
echo "<option value='organizer'>Organizer</option>";
}
if ($role=="organizer") {
echo "<option value='spectator'>Spectator</option>";
echo "<option value='athlete'>Athlete</option>";
echo "<option value='organizer' selected>Organizer</option>";
}
?>
</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>