Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //form data
- $submit = strip_tags($_POST['submit']);
- $fullname = strip_tags($_POST['fullname']);
- $address = strip_tags($_POST['address']);
- $city = strip_tags($_POST['city']);
- $state = strip_tags($_POST['state']);
- $zip = strip_tags($_POST['zip']);
- $phone= strip_tags($_POST['phone']);
- $email = strip_tags($_POST['email']);
- $username = strip_tags($_POST['username']);
- $password = strip_tags($_POST['password']);
- $repeatpassword = strip_tags($_POST['repeatpassword']);
- $date = date("Y-m-d");
- if ($submit)
- {
- //check for existance
- If ($fullname&&$address&&$city&&$state&&$zip&&$phone&&$email&&$username&&$password&&$repeatpassword)
- {
- if ($password==$repeatpassword)
- {
- //check char length of username and fullname
- if (strlen($username)>25||strlen($fullname)>25)
- {
- $nerror=" *Length of username or fullname is too long!";
- }
- else
- {
- //check state length
- if (strlen($state)>2)
- {
- echo "State Must Be 2 Letters";
- }
- else
- {
- //check phone number length
- if (strlen($phone)>10||strlen($phone)<10)
- {
- echo "Phone Number Must Be 10 Digits";
- }
- else
- {
- //check password length
- if (strlen($password)>25||strlen($password)<6)
- {
- $perror=" *Password must be between 6 and 25 characters";
- }
- else
- {
- //register the user!
- echo "Success!!";
- //open database
- $connect = mysql_connect("localhost","root","root");
- mysql_select_db("register"); //select database
- $queryreg = mysql_query("INSERT INTO users VALUES ('','$fullname','$address','$city','$state','$zip','$phone','$email','$username','$password','$date')");
- die(" You have been registered! <a href='members.php'>Return to Login Page</a>");
- }
- }
- }
- else
- $match=" *Your passwords do not match!";
- }
- else
- $all=" *Please fill in <b>all</b> fields!";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement