Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. <?php
  2. $name = null;
  3. $email = null;
  4. $username = null;
  5. $pwd = null;
  6. $pwd2 = null;
  7. if (!empty($_POST)){
  8. ob_end_clean();
  9. $name = htmlspecialchars($_POST["name"]);
  10. $email = htmlspecialchars($_POST["email"]);
  11. $username = htmlspecialchars($_POST["username"]);
  12. $pwd = htmlspecialchars($_POST["pwd"]);
  13. $pwd2 = htmlspecialchars($_POST["pwd2"]);
  14. if ($pwd == $pwd2){
  15. echo "
  16. <!DOCTYPE html>
  17. <html>
  18. <head>
  19. <title>Week 5 Assignment</title>
  20. <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
  21. </head>
  22. <body>
  23. <p>Welcome $name ! Please review the following information that you submitted:</p>
  24. <p>You entered $email as your email.</p>
  25. <p>You entered $username as your username.</p>
  26. <p>You entered $pwd as your password.</p>
  27. </body>
  28. </html>";
  29.  
  30. }
  31. else {
  32. echo "
  33. <!DOCTYPE html>
  34. <html>
  35. <head>
  36. <title>Week 5 Assignment</title>
  37. <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
  38. </head>
  39. <body>
  40. <form action="; echo htmlspecialchars($_SERVER["PHP_SELF"]); echo" method="post">
  41. <p> Name: <input type="text" name="name" value=$name></p>
  42. <p>Email: <input type="email" name="email" value=$email></p>
  43. <p>Username: <input type="text" name="username" value=$username></p>
  44. <p>Password: <input type="password" name="pwd" minlength = 4></p>
  45. <p>Retype Password: <input type="password" name="pwd2"></p>
  46. <input type="submit">
  47. </form>
  48. <p>Passwords did not match</p>
  49. </body>
  50. </html>";
  51. }
  52. }
  53. elseif (empty($_POST)){
  54. echo "
  55. <!DOCTYPE html>
  56. <html>
  57. <head>
  58. <title>Week 5 Assignment</title>
  59. <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
  60. </head>
  61. <body>
  62. <form action="; echo htmlspecialchars($_SERVER["PHP_SELF"]); echo" method="post">
  63. <p> Name: <input type="text" name="name"></p>
  64. <p>Email: <input type="email" name="email"></p>
  65. <p>Username: <input type="text" name="username"></p>
  66. <p>Password: <input type="password" name="pwd" minlength = 4></p>
  67. <p>Retype Password: <input type="password" name="pwd2"></p>
  68. <input type="submit">
  69. </form>
  70. </body>
  71. </html>";
  72. }
  73.  
  74. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement