daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Mar 4th, 2016 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. session_start();
  3.  header('Content-type: text/html; charset=utf-8');
  4.  
  5.   //---------------------------------------------------------
  6.   // Requires fichiers database
  7.   //---------------------------------------------------------
  8.   require_once('../config/configuration.php');
  9.   require_once('../config/baseDonnees.php');
  10.   require_once('../config/fonctions.php');
  11.  
  12.       $titre = 'Liste des membres';
  13.       require_once ("../inc/head.php");
  14.       require_once ("../inc/header.php");
  15. ?>
  16. <style>
  17. div#form {
  18.     width:250px;
  19. }
  20. </style>
  21.  
  22. <?php
  23.  
  24.  
  25.  
  26. if(isset($_POST['formconnexion']))
  27. {
  28.     $mailconnect = htmlspecialchars($_POST['mailconnect']);
  29.     $mdpconnect = sha1($_POST['mdpconnect']);
  30.     if(!empty($mailconnect) AND !empty($mdpconnect))
  31.     {
  32.         $requser = $bdd->prepare("SELECT * FROM joueurs WHERE mail = ? AND mdp = ?");
  33.         $requser->execute(array($mailconnect, $mdpconnect));
  34.         $userexist = $requser->rowCount();
  35.         if($userexist == 1)
  36.         {
  37.             $userinfo = $requser->fetch();
  38.             $_SESSION['utilisateur'] = $userinfo['id'];
  39.             $_SESSION['pseudo'] = $userinfo['pseudo'];
  40.             $_SESSION['mail'] = $userinfo['mail'];
  41.            
  42.             header("Location: profil.php?id=".$_SESSION['utilisateur']);
  43.  
  44.         }
  45.         else
  46.         {
  47.             $show->showError('<center>mauvais mail/pseudo ou mot de passe');
  48.         }
  49.     }
  50.         else
  51.     {
  52.         $show->showError('<center>Tous les champs doivent etre complété');
  53.     }
  54. }
  55.  
  56. ?>
  57. <html>
  58.     <head>
  59.         <title>Connexion</title>
  60.         <meta charset="utf-8">
  61.     </head>
  62.     <body>
  63.         <div align="center">
  64.             <h2>Connexion</h2>
  65.             <br /><br />
  66. <form method="POST" action="">
  67.   <div class="form-group" id="form">
  68.     <label for="exampleInputEmail1">Adresse email ou pseudo</label>
  69.     <input type="text" class="form-control" name="mailconnect" placeholder="email ou pseudo" id="mailconnect">
  70.   </div>
  71.   <div class="form-group" id="form">
  72.     <label for="exampleInputPassword1">mot de passe</label>
  73.     <input type="password" class="form-control" name="mdpconnect" placeholder="mot de passe" id="mdpconnect">
  74.   </div>
  75.  
  76.  
  77.   <button type="submit" name="formconnexion" class="btn btn-default">Se connecter</button>
  78. </form>
  79.             <?php
  80.             if(isset($erreur))
  81.             {
  82.                 echo '<font color="red">'.$erreur."</font>";
  83.             }
  84.             ?>
  85.         </div>
  86.  
  87.        
  88.     </body>
  89. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top