Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $username = $_POST['username'];
- $password = $_POST['password'];
- //connect to database
- //check to see if a user exsist with the matching password
- $sp_checklogin = "CALL jid_checklogin('$username','$password')";
- $rs_checklogin = mysqli_query($conn, $sp_checklogin);
- $checklogin_result = mysqli_num_rows($rs_checklogin);
- if ($checklogin_result == 1) {
- //a user with that username and matching password exsist so start the users session
- session_start();
- $sp_getsessionid = "CALL jid_getsessionid('$username','$password')";
- $rs_getsessionid = mysqli_query($conn, $sp_getsessionid);
- while($row = mysqli_fetch_array($rs_getsessionid)) {
- $_SESSION["id"] = $row['user_uid'];
- }
- 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!";
- }
- else {
- die ("Login Failed");
- }
- ?>
Add Comment
Please, Sign In to add comment