daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Feb 16th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. session_unset(); //Unset any existing sessions
  2.                         session_start(); //Start a new session
  3.                         echo 'success';
  4.                         //Set user details as the sessions parameters for later use
  5.                         $_SESSION["user"] = $username;
  6.                         $_SESSION["userid"] = $row['id'];
  7.                         $_SESSION["firstname"] = $row['firstname'];
  8.                         $_SESSION["lastname"] = $row['lastname'];
  9.                         $_SESSION["perms"] = $row['permissions'];
  10.                         $_SESSION['start'] = time(); // Taking now logged in time.
  11.                         $_SESSION['api_key'] = $row['api_key'];
  12.  
  13.                         // Ending a session in 30 minutes from the starting time.
  14.                         $_SESSION['expire'] = $_SESSION['start'] + (30 * 60);
  15.                         //Redirect user to homepage after login
  16.  
  17.                         echo "<script>window.location.assign('index.php');</script>";
  18.    
  19. session_start();
  20. if (empty($_SESSION)) {
  21.     header("Location: ../login.php");
  22.     die("Please log in first");
  23. } else {
  24.     $firstname = $_SESSION['firstname'];
  25.     $lastname = $_SESSION['lastname'];
  26.     $user_id = $_SESSION['userid'];
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top