Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <title>Writing data to file</title>
- <h1>writing data to a file </h1>
- <body>
- <?php// include 'include.htm'?>
- <?php
- $first = $_POST["fname"];
- $mini = $_POST["mini"];
- $last = $_POST["lname"];
- $email1 = $_POST["email1"];
- $email2 = $_POST["email2"];
- $pw1 = $_POST['pw1'];
- $pw2 = $_POST['pw2'] ;
- $addy = $_POST['addy'] ;
- $num = $_POST['num'] ;
- $choices = isset($_POST['choices']) ? $_POST['choices'] : 0 ;
- $dinner = isset($_POST['dinner']) ? $_POST['choices'] : 0 ;
- $precon = isset($_POST['precon']) ? $_POST['precon'] : 0 ;
- $zip = isset($_POST['zip']) ? $_POST['zip'] : 0 ;
- $total = $choices + $dinner + $precon;
- //checks the lenght of the password1== it has to be greater than 8
- if( strlen($pw1) > 8 || strlen($pw1) < 1 ){
- //Password must be greater than 8 chars
- }
- //looked online for a password regex checker
- $regex = "^\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S*[\W])\S*$^";
- ?>
- <?php
- //prints out md5 of password entered
- $hashForPw1 = md5($pw1);
- echo ("Password Entered is:" .$hashForPw1); ?><br>
- <?php
- if(preg_match($regex, $pw1) == false){
- //this password didn't work
- }
- ?>
- <?php
- //checks the lenght of the zipcode== it has to be greater than 5
- if (strlen($zip) < 5)
- echo "Zip code must be 5 characters or more//Please click the back button to go back";
- else{
- echo "zip codes match";
- } ?><br>
- <?php
- if(empty($pwd1))
- echo('Password: Please enter a password.');
- ?><br>
- <?php
- if(empty($pw2))
- echo('Password: Please enter a confirm password//click the back button to go back');
- ?><br>
- <?php if (md5($pw1) == md5($pw2))
- echo "MD5 of the password is".md5($pw1);
- else{
- echo"Password: Passwords DO NOT match! Please go back and re-enter";
- }
- ?><br>
- <?php
- if(empty($email1) ||
- !filter_var($email1, FILTER_VALIDATE_EMAIL))
- echo "Please click the back button and enter a valid email";
- ?><br>
- <?php
- if($email1 != $email2)
- echo "Email: Email Does Not Match! click the back button to go back AND RE-ENTER!";
- else{
- echo ("Email: The Email You Enter Matches! The Email is" .$email1 );
- ?>
- <br>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement