Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
61f6862dd0 | |||
88deebe096 | |||
c5468c863e |
@ -18,7 +18,7 @@
|
||||
|
||||
<h2>Connexion</h2>
|
||||
|
||||
<form action="php/connexion.php" method="post">
|
||||
<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>
|
||||
|
@ -1,37 +1,73 @@
|
||||
<?php
|
||||
|
||||
// Informations de connexion à la base de données
|
||||
$db = mysqli_connect("dwarves.iut-fbleau.fr","ghouar-t","Bases2023","ghouar-t");
|
||||
if(!$db){
|
||||
die("Connexion BD impossible.");
|
||||
}else{
|
||||
echo "Connexion BD reussie ! <br>";
|
||||
require_once 'common.php';
|
||||
session_start();
|
||||
if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
|
||||
$db = initDatabase();
|
||||
$login = $_POST['login'];
|
||||
$password = $_POST['password'];
|
||||
|
||||
|
||||
$result=mysqli_query($db,"SELECT * FROM user WHERE login = '$login' ");
|
||||
|
||||
if (mysqli_num_rows($result) > 0) {
|
||||
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
$hash = $row['mdp'];
|
||||
|
||||
|
||||
if (password_verify($password, $hash)) {
|
||||
if ($login) {
|
||||
$_SESSION['login'] = $login;
|
||||
header('Location: ../index.html');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
echo "Échec de la connexion : couple login/mot de passe invalide.";
|
||||
}
|
||||
} else {
|
||||
echo "Échec de la connexion : login invalide.";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Récupération des données du formulaire
|
||||
$login = $_POST['login'];
|
||||
$password = $_POST['password'];
|
||||
|
||||
|
||||
$result=mysqli_query($db,"SELECT * FROM user WHERE login = '$login' ");
|
||||
?>
|
||||
|
||||
if (mysqli_num_rows($result) > 0) {
|
||||
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
$hash = $row['mdp'];
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="../css/style.css">
|
||||
<title>Page de Connexion</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
if (password_verify($password, $hash)) {
|
||||
echo "Connexion réussie au mdp !";
|
||||
<div id="content_cours">
|
||||
|
||||
<header>
|
||||
<nav>
|
||||
<a href="../index.html">Page d'accueil</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
|
||||
} else {
|
||||
echo "Échec de la connexion : couple login/mot de passe invalide.";
|
||||
}
|
||||
} else {
|
||||
echo "Échec de la connexion : login invalide.";
|
||||
}
|
||||
<h2>Connexion</h2>
|
||||
|
||||
mysqli_close($db);
|
||||
<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>
|
||||
</html>
|
4
rapport.txt
Normal file
4
rapport.txt
Normal 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
|
Loading…
Reference in New Issue
Block a user