Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include_once("params.php");
- $bdd = new PDO($dsn,$user, $password);
- if(isset($_POST['formconnexion'])){
- $mailconnect = htmlspecialchars($_POST['mailconnect']);
- $mdpconnect = sha1($_POST['mdpconnect']);
- if(!empty($mailconnect) AND !empty($mdpconnect)){
- $requser= $bdd ->prepare("SELECT * FROM CLIENT where mail= ? AND password = ?");
- $requser->execute(array($mailconnect,$mdpconnect));
- $userexist = $requser->rowCount();
- if($userexist == 1){
- $userinfo = $requser ->fetch();
- $_SESSION['id_client']= $userinfo['id_client'];
- $_SESSION['mail']= $userinfo['mail'];
- $_SESSION['login']= $userinfo['login'];
- header("Location: profil.php?id_client=".$_SESSION['id_client']);
- }
- else {
- $erreur= "Mauvais mail ou mot de passe";
- }
- }
- else {
- $erreur="Tous les champs doivent être complétés";
- }
- }
- ?>
- <html lang="fr" xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
- <head>
- <title>CONNEXION</title>
- </head>
- <body>
- <div align="center">
- <h2>CONNEXION</h2><br/>
- <form method="POST" action="">
- <p>mail:</p>
- <input type="email" name="mailconnect" placeholder="Mail">
- <p>mot de passe :</p>
- <input type="password" name="mdpconnect">
- <br/><br/>
- <input type="submit" value="Se connecter !" name="formconnexion">
- </form>
- <?php
- if(isset($erreur)){
- echo '<font color="red">'.$erreur."</font>";
- }
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement