Advertisement
Guest User

Untitled

a guest
May 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.00 KB | None | 0 0
  1. <?php
  2.  
  3. //form data
  4. $submit = strip_tags($_POST['submit']);
  5. $fullname = strip_tags($_POST['fullname']);
  6. $address = strip_tags($_POST['address']);
  7. $city = strip_tags($_POST['city']);
  8. $state = strip_tags($_POST['state']);
  9. $zip = strip_tags($_POST['zip']);
  10. $phone= strip_tags($_POST['phone']);
  11. $email = strip_tags($_POST['email']);
  12. $username = strip_tags($_POST['username']);
  13. $password = strip_tags($_POST['password']);
  14. $repeatpassword = strip_tags($_POST['repeatpassword']);
  15. $date = date("Y-m-d");
  16.  
  17. if ($submit)
  18. {
  19.     //check for existance
  20.     If ($fullname&&$address&&$city&&$state&&$zip&&$phone&&$email&&$username&&$password&&$repeatpassword)
  21.     {
  22.    
  23.         if ($password==$repeatpassword)
  24.         {
  25.             //check char length of username and fullname
  26.             if (strlen($username)>25||strlen($fullname)>25)
  27.                 {
  28.                  $nerror=" *Length of username or fullname is too long!";  
  29.                 }
  30.                 else
  31.                 {
  32.                     //check state length
  33.                     if (strlen($state)>2)
  34.                     {
  35.                      echo "State Must Be 2 Letters";   
  36.                     }
  37.                         else
  38.                         {
  39.                         //check phone number length
  40.                         if (strlen($phone)>10||strlen($phone)<10)
  41.                         {
  42.                           echo "Phone Number Must Be 10 Digits";
  43.                         }
  44.                         else
  45.                         {
  46.                             //check password length
  47.                                     if (strlen($password)>25||strlen($password)<6)
  48.                                     {
  49.                                     $perror=" *Password must be between 6 and 25 characters";
  50.                                     }
  51.                                     else
  52.                                     {
  53.                             //register the user!
  54.                             echo "Success!!";
  55.                            
  56.                             //open database
  57.                             $connect = mysql_connect("localhost","root","root");
  58.                             mysql_select_db("register"); //select database
  59.                            
  60.                             $queryreg = mysql_query("INSERT INTO users VALUES ('','$fullname','$address','$city','$state','$zip','$phone','$email','$username','$password','$date')");
  61.                            
  62.                             die(" You have been registered!  <a href='members.php'>Return to Login Page</a>");
  63.                        
  64.                     }
  65.                     }
  66.                         }
  67.         else
  68.             $match=" *Your passwords do not match!";
  69.                 }
  70.     else
  71.         $all=" *Please fill in <b>all</b> fields!";
  72. }
  73.     }
  74. }
  75.  
  76. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement