Advertisement
maziboi

Untitled

Mar 7th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php
  2. //Table Structure for users - sizzur
  3. //
  4. //Uid - int(11) - Auto Increment ~ 1
  5. //email - text ~ 2
  6. //username - varchar(30) ~ 3
  7. //password - text ~ 4
  8. //
  9.  
  10.  
  11.  
  12. $email = $_POST["email"];
  13. $username = $_POST["uname"];
  14. $password = $_POST["psw"];
  15.  
  16. $conn = mysqli_connect("localhost","root","","steamdb");
  17.  
  18. $query = mysqli_query($conn,"SELECT * FROM users WHERE username='$username'");
  19. $rows = mysqli_num_rows($query);
  20.  
  21. if($rows > 0)
  22. {
  23. session_start();
  24. $_SESSION['error'] = "Account already has this username.";
  25. header("Location: ../createAccount.php");
  26. exit();
  27. }
  28.  
  29. $query = mysqli_query($conn,"SELECT * FROM users WHERE email='$email'");
  30. $rows = mysqli_num_rows($query);
  31.  
  32. if($rows > 0)
  33. {
  34. session_start();
  35. $_SESSION['error'] = "Account already has this email.";
  36. header("Location: ../createAccount.php");
  37. exit();
  38. }
  39.  
  40. //We passed all the checks, lets make an account.
  41. $query = mysqli_query($conn,"INSERT INTO users (email, username, password) VALUES ('$email', '$username', '$password')");
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement