Browse Source

Lycee_fin_cour_15/11

master
sacha.serny 3 years ago
parent
commit
24db56327f
  1. 78
      sign_in.php
  2. 69
      sign_up.html

78
sign_in.php

@ -0,0 +1,78 @@
<!-- Traitement PHP -->
<?php
/*
Faire de la sécurité et de l'optimisation
Ce code est pourri mais VRAIMENT
*/
$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'])) {
if (isset($_POST["f_email"]) AND !empty($_POST["f_email"]) AND isset($_POST["f_password"]) AND !empty($_POST["f_password"])) {
$password = htmlspecialchars($_POST['password']);
$mail = htmlspecialchars($_POST['f_email']);
$look = $bdd->prepare("SELECT * FROM membres WHERE email = :mail");
$look->bindParam(":mail", $mail);
$look->execute();
$userexist = -1;
$userexist = $look->rowCount();
if ($userexist == 0) {
$data = $look->fetch();
var_dump($password,$data['password']);
if (password_verify($password,$data['password'])) {
$erreur = "Vous avez été correctement connecté.";
} else {
$erreur = "Les mots de passe ne correspondent pas.";
}
} else {
$erreur = "Le mail utilisé est inconnu.";
}
}
}
?>
<!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"
name="f_email">
</div>
<div>
<label for="f_password">Mot de passe : </label><input type="password" id="f_password" maxlength="40"
placeholder="Mot de passe"
name="f_password">
</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="submit" value="Se connecter" id="submit">
</div>
</div>
<div>
<?= $erreur ?>
</div>
</form>
</div>
</body>
</html>

69
sign_up.html

@ -1,69 +0,0 @@
<!-- Traitement PHP -->
<?php
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Titre</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style/style_main.css" rel="stylesheet">
<link href="style/style_log.css" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="_content/favicon-32x32.png">
</head>
<body>
<header>
<h1><a class="_title" href="index.html"><span class="word1">Pop</span><span class="word3">Op</span></a></h1>
<ul>
<li><a href="#unlinked">Top</a></li>
<li><a href="#unlinked">Musiques</a></li>
<li><a href="#unlinked">Lectures</a></li>
</ul>
<div>
<a href="sign_in.html">Se connecter</a>
<a href="sign_up.html">S'inscrire</a>
</div>
</header>
<main>
<div class="red-banner">
En attente de l'ajout d'un systeme PHP.
<br>Cette page est moche et mal faite.
</div>
<form action="" method="POST">
<h2>Inscription</h2>
<div class="form_p_contents">
<div>
<label for="pseudo">Pseudo : </label><input autocomplete="off" name="pseudo" type="text"
placeholder="Pseudo">
</div>
<div class="names">
<label for="first_name">Prénom - Nom : </label><input autocomplete="off" name="first_name"
type="text" placeholder="Prénom"><input autocomplete="off" name="surname_name" type="text"
placeholder="Nom">
</div>
<div>
<label for="mail">Adresse mail : </label><input autocomplete="off" name="mail" type="mail"
placeholder="Adresse mail">
</div>
<div>
<label for="password">Mot de passe : </label><input autocomplete="off" name="password"
type="password" placeholder="Mot de passe">
</div>
<br>
<input name="password" type="submit" value="Valider">
</div>
</form>
</main>
<footer>
<a href="#mentions-legales">Conditions générales d'utilisation.</a> <br> Mise en page par SERNY Sacha.
</footer>
</body>
</html>
Loading…
Cancel
Save