Created
September 22, 2012 22:15
-
-
Save hemache/3768012 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $responseIDs = array( | |
| "<form action='".$_SERVER['PHP_SELF']."' method='post' style='float: left;'> | |
| الاسم : <input name='TxtLogin' type='text' maxlength='19' style='width: 90px;'/> | |
| الكلمة السرية : <input name='TxtPassword' type='password' maxlength='19' style='width: 90px;'/> | |
| <input name='BtnLogin' type='submit' value='دخول'/> | |
| </form>", | |
| "<form action='".$_SERVER['PHP_SELF']."' method='post' style='float: left;'> | |
| الاسم : <label>".$_SESSION['Login']."</label> | |
| <input name='BtnLogout' type='submit' value='خروج'/> | |
| </form> ", | |
| "Compte inactive.$formLogin", | |
| "Mot de passe incorrecte.$formLogin", | |
| "Login incorrecte.$formLogin", | |
| "Entrer votre Mot de passe SVP.$formLogin", | |
| "Entrer votre Login SVP.$formLogin", | |
| ); | |
| if(isset($_GET['responseID'])) | |
| { | |
| $responseID = intval($_GET['responseID']); | |
| print($responseIDs[$responseID]); | |
| exit; | |
| } | |
| ?> | |
| <?php | |
| @session_start(); | |
| if(!isset($_SESSION['Etat']) || empty($_SESSION['Etat'])){$_SESSION['Etat'] = 'Deconnecte'; } | |
| $responseID = 0; | |
| ?> | |
| // du code html | |
| <?php | |
| if($_SESSION['Etat'] == 'Deconnecte'){ | |
| if($_POST['BtnLogin']){ | |
| $login = $_POST['TxtLogin']; | |
| $password = $_POST['TxtPassword']; | |
| if($login){ | |
| if($password){ | |
| require("Connexion.php"); | |
| $requette = mysql_query("SELECT * FROM users WHERE Login = '$login'"); | |
| $Nbre = mysql_num_rows($requette); | |
| if($Nbre == 1){ | |
| $infos = mysql_fetch_assoc($requette); | |
| if($infos['Password'] == $password){ | |
| if($infos['Active'] == 1){ | |
| $_SESSION['Etat'] = 'Connecte'; | |
| $_SESSION['ID'] = $infos['IDUser']; | |
| $_SESSION['Login'] = $infos['Login']; | |
| $responseID = 1; | |
| } | |
| else{ | |
| $responseID = 2; | |
| } | |
| } | |
| else{ | |
| $responseID = 3; | |
| } | |
| } | |
| else{ | |
| $responseID = 4; | |
| } | |
| } | |
| else{ | |
| $responseID = 5; | |
| } | |
| } | |
| else{ | |
| $responseID = 6; | |
| } | |
| } | |
| else{ | |
| $responseID = 0; | |
| } | |
| } | |
| else if($_SESSION['Etat'] == 'Connecte'){ | |
| if($_POST['BtnLogout']){ | |
| session_destroy(); | |
| $_SESSION['Etat'] = 'Deconnecte'; | |
| } | |
| $responseID = 0; | |
| } | |
| else{ | |
| $responseID = 0; | |
| } | |
| header('Location: '. $_SERVER['PHP_SELF'] .'?responseID='. $responseID); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment