Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <title>Writing data to file</title>
  4. <h1>writing data to a file </h1>
  5. <body>
  6. <?php// include 'include.htm'?>
  7. <?php
  8. $first = $_POST["fname"];
  9. $mini = $_POST["mini"];
  10. $last = $_POST["lname"];
  11. $email1 = $_POST["email1"];
  12. $email2 = $_POST["email2"];
  13. $pw1 = $_POST['pw1'];
  14. $pw2 = $_POST['pw2'] ;
  15. $addy = $_POST['addy'] ;
  16. $num = $_POST['num'] ;
  17.  
  18. $choices = isset($_POST['choices']) ? $_POST['choices'] : 0 ;
  19. $dinner = isset($_POST['dinner']) ? $_POST['choices'] : 0 ;
  20. $precon = isset($_POST['precon']) ? $_POST['precon'] : 0 ;
  21. $zip = isset($_POST['zip']) ? $_POST['zip'] : 0 ;
  22.  
  23. $total = $choices + $dinner + $precon;
  24.  
  25. //checks the lenght of the password1== it has to be greater than 8
  26. if( strlen($pw1) > 8 || strlen($pw1) < 1 ){
  27. //Password must be greater than 8 chars
  28. }
  29. //looked online for a password regex checker
  30. $regex = "^\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S*[\W])\S*$^";
  31. ?>
  32.  
  33. <?php
  34. //prints out md5 of password entered
  35. $hashForPw1 = md5($pw1);
  36. echo ("Password Entered is:" .$hashForPw1); ?><br>
  37.  
  38. <?php
  39. if(preg_match($regex, $pw1) == false){
  40. //this password didn't work
  41. }
  42. ?>
  43.  
  44. <?php
  45. //checks the lenght of the zipcode== it has to be greater than 5
  46. if (strlen($zip) < 5)
  47. echo "Zip code must be 5 characters or more//Please click the back button to go back";
  48. else{
  49. echo "zip codes match";
  50. } ?><br>
  51. <?php
  52. if(empty($pwd1))
  53. echo('Password: Please enter a password.');
  54. ?><br>
  55.  
  56. <?php
  57. if(empty($pw2))
  58. echo('Password: Please enter a confirm password//click the back button to go back');
  59. ?><br>
  60.  
  61. <?php if (md5($pw1) == md5($pw2))
  62. echo "MD5 of the password is".md5($pw1);
  63. else{
  64. echo"Password: Passwords DO NOT match! Please go back and re-enter";
  65. }
  66. ?><br>
  67.  
  68. <?php
  69. if(empty($email1) ||
  70. !filter_var($email1, FILTER_VALIDATE_EMAIL))
  71. echo "Please click the back button and enter a valid email";
  72. ?><br>
  73.  
  74. <?php
  75. if($email1 != $email2)
  76. echo "Email: Email Does Not Match! click the back button to go back AND RE-ENTER!";
  77. else{
  78. echo ("Email: The Email You Enter Matches! The Email is" .$email1 );
  79. ?>
  80. <br>
  81.  
  82. </body>
  83. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement