Advertisement
Guest User

Untitled

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