Advertisement
Guest User

Untitled

a guest
Mar 13th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   <?php
  2.     require_once('inc/config.php');
  3.        
  4.                
  5.                
  6.                     if(empty($_POST['user'])){header('location: index.php?user=false');}
  7.                     else if(empty($_POST['password'])){header('location: index.php?password=false');}
  8.                     else
  9.                     {
  10.                          
  11.                         // Vérification des identifiants
  12.                        
  13.                         $password = hash('md5',$_POST['password']);
  14.                        
  15.                        
  16.                         $req = $bdd->prepare('SELECT * FROM samp_accounts WHERE pLogin = :pseudo AND pPassword = :pass');
  17.                         $req->execute(array(
  18.                             'pseudo' => $_POST['user'],
  19.                             'pass' => $password));
  20.  
  21.                         $resultat = $req->fetch();
  22.                        
  23.                        
  24.                         if (!$resultat)
  25.                         {
  26.                             echo '<div class="alert alert-danger">
  27.                             <strong>ATTENTION!</strong>
  28.                                         Attention ce compte n\'existe pas
  29.                                     </div>
  30.                                 ';
  31.                         }
  32.                        
  33.                         else
  34.                         {
  35.                            
  36.                            
  37.                             $_SESSION['admin'] = $resultat['pAdmin'];
  38.                             $_SESSION['mappeur'] = $resultat['pMappeur'];
  39.                             $_SESSION['dev'] = $resultat['pDev'];
  40.                             $_SESSION['id'] = $resultat['pID'];
  41.                             $_SESSION['login'] = $_POST['user'];
  42.                             $_SESSION['email'] = $resultat['pEmail'];
  43.                             $_SESSION['password'] = $_POST['password'];
  44.                             $_SESSION['key'] = $resultat['ts_key'];
  45.                            
  46.                            
  47.                             echo 'Connexion en cours merci de patientez...';
  48.                             echo '<meta http-equiv="refresh" content="2; URL=profil.php">';
  49.                        
  50.                         }
  51.  
  52.                     }
  53.                
  54.        
  55.        
  56.        
  57.         ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement