Browse Source

test

master
SERNY Sacha 3 years ago
parent
commit
1fa6d08bba
  1. 2
      index.html
  2. 4
      mentions-legales.html
  3. 2
      reading.html
  4. 43
      sign_in.html
  5. 77
      sign_in.php
  6. 10
      sign_up.php

2
index.html

@ -19,7 +19,7 @@
<li><a href="reading.html">Lectures</a></li> <li><a href="reading.html">Lectures</a></li>
</ul> </ul>
<div> <div>
<a href="sign_in.html">Se connecter</a> <a href="sign_in.php">Se connecter</a>
<a href="sign_up.php">S'inscrire</a> <a href="sign_up.php">S'inscrire</a>
</div> </div>
</header> </header>

4
mentions-legales.html

@ -18,8 +18,8 @@
<li><a href="#unlinked">Lectures</a></li> <li><a href="#unlinked">Lectures</a></li>
</ul> </ul>
<div> <div>
<a href="sign_in.html">Se connecter</a> <a href="sign_in.php">Se connecter</a>
<a href="sign_up.html">S'inscrire</a> <a href="sign_up.php">S'inscrire</a>
</div> </div>
</header> </header>
</body> </body>

2
reading.html

@ -19,7 +19,7 @@
<li><a href="reading.html">Lectures</a></li> <li><a href="reading.html">Lectures</a></li>
</ul> </ul>
<div> <div>
<a href="sign_in.html">Se connecter</a> <a href="sign_in.php">Se connecter</a>
<a href="sign_up.php">S'inscrire</a> <a href="sign_up.php">S'inscrire</a>
</div> </div>
</header> </header>

43
sign_in.html

@ -1,43 +0,0 @@
<!-- Traitement PHP -->
<?php
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Conenxion</title>
<meta charset="UTF-8">
<link href="style/style_log.css" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="_content/favicon-32x32.png">
</head>
<body>
<div class="log-area">
<p>Connecte-toi pour accéder à plus de foncitonnalités</p>
<form action="" method="POST">
<div class="f_inputs">
<div>
<label for="f_email">Adresse mail : </label><input type="email" id="f_email" maxlength="70"
placeholder="Adresse mail">
</div>
<div>
<label for="f_password">Mot de passe : </label><input type="password" id="f_password" maxlength="40"
placeholder="Mot de passe">
</div>
</div>
<div class="buttons">
<div class="sign_up">
<a href="sign_up.html">Pas de compte ?</a>
</div>
<div class="sign_in">
<input type="submit" name="" value="Se connecter" id="submit">
</div>
</div>
</form>
</div>
</body>
</html>

77
sign_in.php

@ -0,0 +1,77 @@
<!-- Traitement PHP -->
<?php
$servername = 'mysql-serny-nsi.alwaysdata.net';
$username = 'serny-nsi';
$mdp = 'ecole9090*';
$bdd = new PDO('mysql:host=mysql-serny-nsi.alwaysdata.net;dbname=serny-nsi_main', $username, $mdp);
if (isset($_POST['submit'])) {
$response ="here2";
if (isset($_POST['f_email']) AND !empty($_POST['f_email']) AND isset($_POST['f_password']) AND !empty($_POST['f_password'])) {
$email = htmlspecialchars($_POST['f_email']);
$password = htmlspecialchars($_POST['f_password']);
$look = $bdd->prepare("SELECT * FROM membres WHERE mail = ?");
$look->execute(array($email));
$check = $look->fetch();
var_dump($check['password']);
var_dump($password);
var_dump(password_verify($password, $check['password']));
$response ="here";
if ($check['mail'] != $email) {
$response = "Ce compte n'existe pas.";
}
else {
if (password_verify($password, $check['password'])) {
$response = "Vous êtes maintenant connecté.";
header('location: https://serny-nsi.alwaysdata.net');
} else {
$response = "Le mot de passe n'est pas valide.";
}
}
} else {
$response ="Veuillez remplir les champs ci-dessus.";
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Conenxion</title>
<meta charset="UTF-8">
<link href="style/style_log.css" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="_content/favicon-32x32.png">
</head>
<body>
<div class="log-area">
<p>Connecte-toi pour accéder à plus de foncitonnalités</p>
<form action="" method="POST">
<div class="f_inputs">
<div>
<label for="f_email">Adresse mail : </label><input type="email" name="f_email" id="f_email" maxlength="70"
placeholder="Adresse mail">
</div>
<div>
<label for="f_password">Mot de passe : </label><input type="password" name="f_password" id="f_password" maxlength="40"
placeholder="Mot de passe">
</div>
</div>
<div class="buttons">
<div class="sign_up">
<a href="sign_up.php">Pas de compte ?</a>
</div>
<div class="sign_in">
<input type="submit" name="submit" value="Se connecter" id="submit">
</div>
</div>
<p><?= $response ?></p>
</form>
</div>
</body>
</html>

10
sign_up.php

@ -14,7 +14,7 @@ if (isset($_POST['submit'])) {
if (isset($_POST["f_email"]) AND !empty($_POST["f_email"]) AND isset($_POST["f_pseudo"]) AND !empty($_POST["f_pseudo"])AND isset($_POST["f_password"]) AND !empty($_POST["f_password"]) AND isset($_POST['f_password2']) AND !empty($_POST['f_password2'])) { if (isset($_POST["f_email"]) AND !empty($_POST["f_email"]) AND isset($_POST["f_pseudo"]) AND !empty($_POST["f_pseudo"])AND isset($_POST["f_password"]) AND !empty($_POST["f_password"]) AND isset($_POST['f_password2']) AND !empty($_POST['f_password2'])) {
if ($_POST['f_password'] == $_POST['f_password2']) { if ($_POST['f_password'] == $_POST['f_password2']) {
$password = password_hash(htmlspecialchars($_POST['password']), PASSWORD_BCRYPT); $password = password_hash(htmlspecialchars($_POST['f_password']), PASSWORD_DEFAULT);
$pseudo = htmlspecialchars($_POST['f_pseudo']); $pseudo = htmlspecialchars($_POST['f_pseudo']);
$mail = htmlspecialchars($_POST['f_email']); $mail = htmlspecialchars($_POST['f_email']);
$mail2 = htmlspecialchars($_POST['f_email2']); $mail2 = htmlspecialchars($_POST['f_email2']);
@ -48,6 +48,8 @@ if (isset($_POST['submit'])) {
} else { } else {
$erreur = "Les mots de passe sont différents."; $erreur = "Les mots de passe sont différents.";
} }
} else {
$erreur = "Veuillez remplir les champs ci-dessus.";
} }
} }
@ -94,15 +96,15 @@ if (isset($_POST['submit'])) {
</div> </div>
<div class="buttons"> <div class="buttons">
<div class="sign_up"> <div class="sign_up">
<a href="sign_in.html">Déjà un compte ?</a> <a href="sign_in.php">Déjà un compte ?</a>
</div> </div>
<div class="sign_in"> <div class="sign_in">
<input type="submit" name="submit" value="S'inscrire" id="submit"> <input type="submit" name="submit" value="S'inscrire" id="submit">
</div> </div>
</div> </div>
<div> <p>
<?= $erreur ?> <?= $erreur ?>
</div> </p>
</form> </form>
</div> </div>
</body> </body>

Loading…
Cancel
Save