Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <?php session_start(); /* Starts the session */
  2.  
  3. /* Check Login form submitted */
  4. if(isset($_POST['submit'])){
  5. /* Define username and associated password array */
  6. $logins = array('admin' => '123','admin1' => '123','admin3' => '123');
  7.  
  8. /* Check and assign submitted Username and Password to new variable */
  9. $Username = isset($_POST['user']) ? $_POST['user'] : '';
  10. $Password = isset($_POST['pass']) ? $_POST['pass'] : '';
  11.  
  12. /* Check Username and Password existence in defined array */
  13. if (isset($logins[$Username]) && $logins[$Username] == $Password){
  14. /* Success: Set session variables and redirect to Protected page */
  15. $_SESSION['UserData']['Username']=$logins[$Username];
  16. header("location:index.php");
  17. exit;
  18. } else {
  19. echo " Failed";
  20. }
  21. }
  22. ?>
  23.  
  24. <!DOCTYPE html>
  25. <html class=" ">
  26.  
  27.  
  28. <!-- BEGIN BODY -->
  29. <body class=" login_page">
  30.  
  31.  
  32. <div>
  33. <div>
  34. <h1><a href="#" title="Login Page" tabindex="-1">Login</a></h1>
  35.  
  36. <form action="" method="post">
  37. <p>
  38. <label for="user_login">Username<br />
  39. <input type="text" name="user" id="user_login" class="input" value="" size="20" /></label>
  40. </p>
  41. <p>
  42. <label for="user_pass">Password<br />
  43. <input type="password" name="pass" id="user_pass" class="input" value="" size="20" /></label>
  44. </p>
  45.  
  46.  
  47.  
  48.  
  49. <p class="submit">
  50. <input type="submit" name="submit" value="Sign In" />
  51. </p>
  52. </form>
  53.  
  54.  
  55. </body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement