Guest User

Untitled

a guest
Oct 24th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. <html>
  2. <body>
  3. <?php
  4. echo "<form action='oneFile.php' method='post'>";
  5. echo "<table border='0'>";
  6. echo "<tr bgcolor='#cccccc'>";
  7. echo "<td width='150'>Username: </td>";
  8. echo "<td width='20'><input type='text' name='username' size='15'
  9. maxlength='15'></td>";
  10. echo "</tr><tr><tr bgcolor='#cccccc'>";
  11. echo "<td width='150'>Password: </td>";
  12. echo "<td width='20'><input type='password' name='password' size='15'
  13. maxlength='15'></td>";
  14. echo "</tr></tr><tr><td colspan='2' align='center'>
  15. <input type='submit' value='Login'></td>
  16. </tr>
  17. </table>
  18. </form>
  19. </body>
  20. </html>";
  21. ?>
  22. <?php
  23. $usernameArr = array( 1 => "elliez",
  24. 2 => "greatGuy",
  25. 3 => "blogger",
  26. 4 => "bob",
  27. 5 => "mike",
  28. 6 => "jane",
  29. 7 => "joe",
  30. 8 => "rachel",
  31. 9 => "james",
  32. 10 => "pizzaman2000");
  33. $passwordArr = array( 1 => "tr789ial",
  34. 2 => "abc123",
  35. 3 => "23seventeen23",
  36. 4 => "12345",
  37. 5 => "Password123",
  38. 6 => "P@ssword123",
  39. 7 => "pass123",
  40. 8 => "123pass",
  41. 9 => "123P@ssword",
  42. 10 => "54321");
  43.  
  44. $varBool = false;
  45.  
  46.  
  47. if(isset($_POST['submit'])){
  48. $username = htmlspecialchars(trim($_POST['username']));
  49. $password = htmlspecialchars(trim($_POST['password']));
  50. trim($username);
  51. trim($password);
  52. }
  53.  
  54. for ( $i = 1; $i <= 10; $i++){
  55. if ($username == $usernameArr[$i] && $password === $passwordArr[$i]){
  56. $varBool = true;
  57. }
  58. }
  59. If ($varBool){
  60. echo "You have successfully logged in!";
  61. }
  62. else{
  63. echo "Oops something went wrong try again!";
  64. }
  65.  
  66. ?>
Add Comment
Please, Sign In to add comment