Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['submit'])) {
- $email = $_POST['email'];
- $username = $_POST['username'];
- $password = $_POST['password'];
- $rpassword = $_POST['password_re'];
- if(!empty($email) && !empty($username) && !empty($password) && !empty($rpassword)) {
- if ($password == $rpassword) {
- $sql = "SELECT * FROM Players WHERE username = '$username'";
- if ($result=mysqli_query($configconn,$sql)) {
- if(mysqli_num_rows($result)) {
- echo '<center><div class="alert alert-danger">Username already exists!</div></center>';
- mysqli_close($configconn);
- } else {
- $password = sha1($password);
- $sql = "INSERT INTO Players (id, username, email, password) VALUES (NULL, '$username', '$email', '$password')";
- if (mysqli_query($configconn, $sql)) {
- echo '<center><div class="alert alert-success">Registered Successfully!</div></center>';
- mysqli_close($configconn);
- }
- }
- }
- } else {
- echo '<center><div class="alert alert-danger">Passwords do not match!</div></center>';
- }
- } else {
- echo '<center><div class="alert alert-danger">Fill in all fields!</div></center>';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement