Advertisement
Guest User

Untitled

a guest
May 11th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "";
  6. $database = "altarius";
  7.  
  8. $conn = mysqli_connect($servername, $username, $password, $database);
  9.  
  10.  
  11. if (isset($_POST["submit"])) {
  12.  
  13. $user = mysqli_real_escape_string($conn, $_POST['user']);;
  14.  
  15. if(empty($user)) {
  16. header("Location: ../index.php?signup=empty");
  17. exit();
  18. } else {
  19.  
  20. $sql = "SELECT * FROM users WHERE user_uid='$user'";
  21. $result = mysqli_query($conn, $sql);
  22. $resultCheck = mysqli_num_rows($result);
  23.  
  24.  
  25. if($resultCheck > 0) {
  26. header("Location: ../signup.php?sigup=usertaken");
  27. exit();
  28. } else {
  29.  
  30. $sql = "INSERT INTO `dbtest` (`user`) VALUES ('. $user .');";
  31.  
  32. mysqli_query($sql, $conn);
  33. //success
  34. header("Location: ../index.php?signup=success");
  35. exit();
  36. }
  37.  
  38.  
  39. }
  40.  
  41.  
  42.  
  43. } else {
  44. Header("Location: ../index.php");
  45. exit();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement