Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if (isset($_SESSION['login'])) {
- header ('Location: membre');
- exit();
- }
- include('inc/config.php');
- if (isset($_POST['connexion']) && $_POST['connexion'] == 'Connexion') {
- if ((isset($_POST['login']) && !empty($_POST['login'])) && (isset($_POST['password']) && !empty($_POST['password']))) {
- $sql = 'SELECT count(*) FROM accounts WHERE Username="'.mysql_real_escape_string($_POST['login']).'" AND Password="'.mysql_real_escape_string($_POST['password']).'"';
- $req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
- $data = mysql_fetch_array($req);
- mysql_free_result($req);
- if ($data[0] == 1) {
- session_start();
- $_SESSION['login'] = $_POST['login'];
- $_SESSION['password'] = $_POST['password'];
- header('Location: membre');
- exit();
- } elseif ($data[0] == 0) { $erreur = '<u>Identifiants non reconnus.</u>'; }
- else { $erreur = '<u>Problème de connexion au serveur. Contactez le webmaster Narco</u>'; }
- } else { $erreur = '<u>Au moins un des champs est vide</u>.'; }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement