Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.49 KB | None | 0 0
  1. <?php
  2. include 'connection.php';
  3.  
  4. $username = strip_tags($_POST['username']);
  5. $password = md5(strip_tags($_POST['password']));
  6. $passwordconfirm = md5(strip_tags($_POST['password1']));
  7. $email = strip_tags($_POST['email']);
  8. $emailconfirm = strip_tags($_POST['email1']);
  9.  
  10.  
  11. $user = mysql_real_escape_string($username);
  12. $pwd = mysql_real_escape_string($password);
  13. if ($username && $password && $passwordconfirm && $email && $emailconfirm)
  14. {
  15. if (ctype_alnum($username))
  16. {
  17.     $query = "SELECT username FROM users WHERE username = '$username'";
  18.     $checkname = mysql_query($query);
  19.     $rows = mysql_num_rows($checkname);
  20.     // check username
  21.     if ($rows == 0)
  22.     {
  23.         $queryemail="SELECT email FROM users WHERE email='$email'";
  24.  
  25.         $emailcheck = mysql_query($queryemail);
  26.         $rows1 = mysql_num_rows($emailcheck);
  27.         // check email
  28.         if ($rows1 == 0)
  29.         {
  30.             // Check to see if email and confirm email and password and confirm password match
  31.             if($email == $emailconfirm && $password == $passwordconfirm)
  32.             {  
  33.                 $query1 ="INSERT INTO users (username, password, email) VALUES('$username', '$password', '$email')";
  34.                 $insert = mysql_query($query1);
  35.             }  
  36.             else{
  37.                 echo "Your email and confirm email and password and confirm password has to match!";
  38.             }
  39.         }
  40.         else
  41.         {
  42.             echo "That email is already in use";
  43.         }
  44.     }
  45.     else{
  46.         echo "That username is already in use.";
  47.     }
  48. }
  49. else
  50. {  
  51.     echo "Your name can only be letters and numbers";
  52. }
  53. }
  54. else
  55. {
  56.     echo "You must fill out all fields!";
  57. }
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement