Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2. if (isset($_POST['subs'])) {
  3.  
  4. include 'connection.php';
  5.  
  6.  
  7. $flname = $_POST['flname'];
  8. $gender = $_POST['gender'];
  9. $user = $_POST['user'];
  10. $pass = $_POST['pass'];
  11. $cpass = $_POST['cpass'];
  12. $hruser = $_POST['hruser'];
  13.  
  14. $usercheck = mysqli_query($conn,"SELECT * from users where username = '$user'");
  15.  
  16. if($usercheck == $_POST['user'] ) {
  17. header("location:admin.php?userun");
  18. }
  19.  
  20. else{
  21.  
  22.  
  23. if ($_POST['pass'] != $_POST['cpass']) {
  24. header("location:admin.php?error");
  25.  
  26. }
  27.  
  28. else {
  29.  
  30.  
  31. $insertData = "INSERT INTO `users`(`username`,`password`,`nameofuser`,`usertype`,`gender`) VALUES ('$user','$pass','$flname','$hruser','$gender')";
  32. if ($conn->query($insertData) === TRUE) {
  33. header("location:admin.php?success");
  34. }else{
  35. echo "Error: " . $insertData . "<br>" . $conn->error;
  36. }
  37. }
  38. }
  39.  
  40. }
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement