Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <html>
  2. <head></head>
  3. <body>
  4. <h4>Please Enter Your Username and Password:</h4>
  5. <form action='<?php echo $_SERVER["PHP_SELF"] ?>' method='post'>
  6. <p>
  7. <label for="strPassword">Username: </label>
  8. <input type='text' name='strUser' id='strUser'/></p>
  9.  
  10. <form action='<?php echo $_SERVER["PHP_SELF"] ?>' method='post'>
  11. <p>
  12. <label for="strPassword">Password: </label>
  13. <input type='text' name='strPassword' id='strPassword'/></p>
  14. <p><input type='submit' name='submit'/></p>
  15. </form>
  16.  
  17. <?php
  18.  
  19. $arrUserPassword = array ("gorgor" => "tyrantlizard", "dwt" => "slowmentaltorture", "bedlamsticks" => "carnivore");
  20.  
  21.  
  22. if (isset($_POST["submit"])){
  23.  
  24. $strUser = $_POST["strUser"];
  25. $strPassword = $_POST["strPassword"];
  26.  
  27. if (array_key_exists($strUser, $strUserPassword)) {
  28.  
  29. if (in_array($strPassword, $arrUserPassword)){
  30. $strAcceptedPassword = $arrUserPassword[$strUser];
  31.  
  32. if ($strAcceptedPassword == $strPassword){
  33. echo "Username and Password match!";
  34. }
  35. }
  36. else
  37. echo "Incorrect Password.";
  38. }
  39.  
  40. else
  41. echo "No such Username.";
  42. }
  43.  
  44.  
  45. ?>
  46.  
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement