Guest User

Untitled

a guest
Oct 23rd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <html>
  2. <body>
  3.  
  4. <form action="index.php" method="post">
  5. <table border="0">
  6. <tr bgcolor="#cccccc">
  7. <td width="150">Username: </td>
  8. <td width="20"><input type="text" name="username" size="15"
  9. maxlength="15"></td>
  10. </tr>
  11. <tr>
  12. <tr bgcolor="#cccccc">
  13. <td width="150">Password: </td>
  14. <td width="20"><input type="password" name="password" size="15"
  15. maxlength="15"></td>
  16. </tr>
  17. </tr>
  18. <tr>
  19. <td colspan="2" align="center"><input type="submit" value="Login"></td>
  20. </tr>
  21.  
  22. </table>
  23. </form>
  24. </body>
  25. </html>
  26. <?php
  27.  
  28.  
  29. $username = htmlspecialchars($_POST['username']);
  30. $password = htmlspecialchars($_POST['password']);
  31. trim($username);
  32. trim($password);
  33.  
  34. $usernameArr = array( 1 => "a",
  35. 2 => "b",
  36. 3 => "c",
  37. 4 => "d",
  38. 5 => "e",
  39. 6 => "f",
  40. 7 => "g",
  41. 8 => "h",
  42. 9 => "i",
  43. 10 => "j");
  44. $passwordArr = array( 1 => "pass1",
  45. 2 => "pass2",
  46. 3 => "pass3",
  47. 4 => "pass4",
  48. 5 => "pass5",
  49. 6 => "pass6",
  50. 7 => "pass7",
  51. 8 => "pass8",
  52. 9 => "pass9",
  53. 10 => "pass0");
  54. $varBool = false;
  55. for ( $i = 1; $i <= 10; $i++){
  56. if ($username == $usernameArr[$i] && $password === $passwordArr[$i]){
  57. $varBool = true;
  58. }
  59. }
  60. If ($varBool){
  61. echo "You have successfully logged in!";
  62. }
  63. else{
  64. echo "Sorry, wrong information has been entered!";
  65. }
  66.  
  67. ?>
Add Comment
Please, Sign In to add comment