Advertisement
Guest User

Untitled

a guest
Jan 9th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <?php
  2. INCLUDE("dbConnect.php");
  3.  
  4. session_start();
  5. $_SESSION['loggedIn'] = false;
  6.  
  7. if (isset($_POST['SubmitProjectRdv'])) {
  8. $username = $_POST['username'];
  9. $password = $_POST['password'];
  10.  
  11. $SQL = "SELECT * FROM `users` WHERE `name` LIKE '$username' AND `password` LIKE '$password'";
  12.  
  13. //die($SQL);
  14.  
  15. $result = mysqli_query($conn, $SQL);
  16.  
  17. if($result != false)
  18. {
  19. //something went wrong, query is not correct or something else happened.
  20. if(mysqli_num_rows($result) > 0)
  21. {
  22. //database shows at least 1 record (tupel) so the combination of username and password does exist.
  23. $_SESSION['loggedIn'] = true;
  24. //echo "super";
  25.  
  26. header('Location: cms.php');
  27. }
  28. else
  29. {
  30. //database does not contain the username and password combination.
  31. $_SESSION['loggedIn'] = false;
  32. }
  33. }
  34. }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement