Guest User

Untitled

a guest
Jun 22nd, 2018
103
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.  
  3. $username = $_POST['username'];
  4. $password = $_POST['password'];
  5.  
  6. //connect to database
  7.  
  8.  
  9. //check to see if a user exsist with the matching password
  10. $sp_checklogin = "CALL jid_checklogin('$username','$password')";
  11.  
  12. $rs_checklogin = mysqli_query($conn, $sp_checklogin);
  13.  
  14. $checklogin_result = mysqli_num_rows($rs_checklogin);
  15.  
  16. if ($checklogin_result == 1) {
  17. //a user with that username and matching password exsist so start the users session
  18. session_start();
  19.  
  20. $sp_getsessionid = "CALL jid_getsessionid('$username','$password')";
  21. $rs_getsessionid = mysqli_query($conn, $sp_getsessionid);
  22. while($row = mysqli_fetch_array($rs_getsessionid)) {
  23. $_SESSION["id"] = $row['user_uid'];
  24. }
  25.  
  26. echo "Logged in with session id of: " . $_SESSION['id'] . " you can now go to your <a href='home.php'>home</a> and begin using all our wonderful features!";
  27. }
  28.  
  29. else {
  30. die ("Login Failed");
  31.  
  32. }
  33.  
  34. ?>
Add Comment
Please, Sign In to add comment