Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $database = "altarius";
- $conn = mysqli_connect($servername, $username, $password, $database);
- if (isset($_POST["submit"])) {
- $user = mysqli_real_escape_string($conn, $_POST['user']);;
- if(empty($user)) {
- header("Location: ../index.php?signup=empty");
- exit();
- } else {
- $sql = "SELECT * FROM users WHERE user_uid='$user'";
- $result = mysqli_query($conn, $sql);
- $resultCheck = mysqli_num_rows($result);
- if($resultCheck > 0) {
- header("Location: ../signup.php?sigup=usertaken");
- exit();
- } else {
- $sql = "INSERT INTO `dbtest` (`user`) VALUES ('. $user .');";
- mysqli_query($sql, $conn);
- //success
- header("Location: ../index.php?signup=success");
- exit();
- }
- }
- } else {
- Header("Location: ../index.php");
- exit();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement