Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'connection.php';
- $username = strip_tags($_POST['username']);
- $password = md5(strip_tags($_POST['password']));
- $passwordconfirm = md5(strip_tags($_POST['password1']));
- $email = strip_tags($_POST['email']);
- $emailconfirm = strip_tags($_POST['email1']);
- $user = mysql_real_escape_string($username);
- $pwd = mysql_real_escape_string($password);
- if ($username && $password && $passwordconfirm && $email && $emailconfirm)
- {
- 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";
- }
- }
- else
- {
- echo "You must fill out all fields!";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement