Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('inc/config.php');
- if(empty($_POST['user'])){header('location: index.php?user=false');}
- else if(empty($_POST['password'])){header('location: index.php?password=false');}
- else
- {
- // Vรฉrification des identifiants
- $hash = $bdd->query('SELECT * FROM accounts WHERE username = "'.$_POST['user'].'"');
- $req = $hash->fetch();
- $password = hash('md5',$_POST['password']);
- $pass = hash('md5',$password.''.$req['salt']);
- $req = $bdd->prepare('SELECT * FROM accounts WHERE username = :pseudo AND password = :pass');
- $req->execute(array(
- 'pseudo' => $_POST['user'],
- 'pass' => $pass));
- $resultat = $req->fetch();
- if (!$resultat)
- {
- echo '<div class="alert alert-danger">
- <strong>ATTENTION!</strong>
- Attention ce compte n\'existe pas
- </div>
- ';
- }
- else
- {
- $_SESSION['admin'] = $resultat['admin'];
- $_SESSION['supporter'] = $resultat['supporter'];
- $_SESSION['vct'] = $resultat['vct'];
- $_SESSION['mappeur'] = $resultat['mapper'];
- $_SESSION['admin'] = $resultat['scripter'];
- $_SESSION['id'] = $resultat['id'];
- $_SESSION['login'] = $_POST['user'];
- $_SESSION['email'] = $resultat['email'];
- $_SESSION['password'] = $_POST['password'];
- echo 'Connexion en cours merci de patientez...';
- echo '<meta http-equiv="refresh" content="2; URL=main-page.php">';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement