Guest User

Untitled

a guest
Dec 7th, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4. <html>
  5. <head>
  6. <title>Two Factor Authentication Demo</title>
  7. <style>
  8. .center {
  9. margin-left: auto;
  10. margin-right: auto;
  11. margin-top: 25px;
  12. }
  13. #submit { float: right; }
  14. form { border-style: solid; padding: 10px; width: 300px; }
  15. input[type="button"], input[type="text"], input[type="password"]
  16. { float: right; }
  17. div { text-align: center; width: 500px; }
  18. span { font-size:30px;color:red; }
  19. </style>
  20. </head>
  21. <body>
  22. <div class="center">
  23. <?php if((urldecode($_GET['action'])) != "login") { ?>
  24. <p>This is just a demo that demonstrates how SMS could be
  25. integrated to build a simple two-factor authentication system.</p>
  26. <p>No matter what username you put into the initial box, the system
  27. will generate a one-time use password similar to an RSA token.
  28. Once this password is used, the user's session is set and the
  29. password is destroyed. In this particular case, we're not
  30. storing anything long term.</p>
  31. <?php } ?>
  32. <span id="message">
  33. <?php
  34. $message = urldecode($_GET['message']);
  35. echo preg_replace("/[^A-Za-z0-9 ,']/", "", $message);
  36. $action = (isset($_SESSION['password'])) ? 'login' : 'token';
  37. ?>
  38. </span>
  39. </div>
  40. <?php if((urldecode($_GET['action'])) != "login") { ?>
  41. <form id="reset-form" action="process.php" method="POST" class="center">
  42. <input type="hidden" name="action" value="<?php echo $action; ?>" />
  43. <p>Username: <input type="text" name="username" id="username" value="<?php echo $_SESSION['username']; ?>" /></p>
  44. <?php if (isset($_SESSION['password'])) { ?>
  45. <p>Password: <input type="password" name="password" id="password" /></p>
  46. <?php } else { ?>
  47. <p>Phone Number: <input type="text" name="phone_number" id="phone_number" /></p>
  48. <?php } ?>
  49. <p><input type="submit" name="submit" id="submit" value="login!" /></p>
  50. <p>&nbsp;</p>
  51. </form>
  52. <?php } ?>
  53. </body>
  54. </html>
Add Comment
Please, Sign In to add comment