Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Table Structure for users - sizzur
- //
- //Uid - int(11) - Auto Increment ~ 1
- //email - text ~ 2
- //username - varchar(30) ~ 3
- //password - text ~ 4
- //
- $email = $_POST["email"];
- $username = $_POST["uname"];
- $password = $_POST["psw"];
- $conn = mysqli_connect("localhost","root","","steamdb");
- $query = mysqli_query($conn,"SELECT * FROM users WHERE username='$username'");
- $rows = mysqli_num_rows($query);
- if($rows > 0)
- {
- session_start();
- $_SESSION['error'] = "Account already has this username.";
- header("Location: ../createAccount.php");
- exit();
- }
- $query = mysqli_query($conn,"SELECT * FROM users WHERE email='$email'");
- $rows = mysqli_num_rows($query);
- if($rows > 0)
- {
- session_start();
- $_SESSION['error'] = "Account already has this email.";
- header("Location: ../createAccount.php");
- exit();
- }
- //We passed all the checks, lets make an account.
- $query = mysqli_query($conn,"INSERT INTO users (email, username, password) VALUES ('$email', '$username', '$password')");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement