Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'connection.php';
- $username = $_POST['username'];
- $password = $_POST['password'];
- $passwordconfirm = $_POST['password1'];
- $email = $_POST['email'];
- $emailconfirm = $_POST['email1'];
- if (ctype_alnum($username))
- {
- $query = "SELECT username FROM users WHERE username = '$username'";
- $checkname = mysql_query($query);
- $rows = mysql_num_rows($checkname);
- // check username
- if ($rows == 0)
- {
- $queryemail="SELECT email FROM users WHERE email='$email'";
- $emailcheck = mysql_query($queryemail);
- $rows1 = mysql_num_rows($emailcheck);
- // check email
- if ($rows1 == 0)
- {
- // Check to see if email and confirm email and password and confirm password match
- if($email == $emailconfirm && $password == $passwordconfirm)
- {
- $query1 ="INSERT INTO users (username, password, email) VALUES('$username', '$password', '$email')";
- $insert = mysql_query($query1);
- }
- else{
- echo "Your email and confirm email and password and confirm password has to match!";
- }
- }
- else
- {
- echo "That email is already in use";
- }
- }
- else{
- echo "That username is already in use.";
- }
- }
- else
- {
- echo "Your name can only be letters and numbers";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement