Advertisement
Guest User

session checker

a guest
Aug 27th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.82 KB | None | 0 0
  1. <?
  2. session_start();
  3.  
  4.  
  5.  
  6. $GLOBALS["Index"] = "/Login/";
  7. $GLOBALS["Landing"] = "/Landing/";
  8.  
  9. $SessionStatus = session_status();
  10.  
  11. if ($SessionStatus == PHP_SESSION_NONE){
  12.     echo "None";
  13.     Out();
  14. }else if ($SessionStatus == PHP_SESSION_DISABLED){
  15.     echo "Disabled";
  16.     Out();
  17. }else if($SessionStatus == PHP_SESSION_ACTIVE){
  18.     if ((isset($_SESSION["Username"]))){
  19.         if ($Window == 'Index'){
  20.             header("Location: " . $GLOBALS["Landing"]);
  21.         }
  22.         if ($Window == "Landing" && $_SESSION["Username"] == "FileUpload"){
  23.             out();
  24.         }
  25.     }else if ($Window == "Index"){
  26.         //session_reset();
  27.     }else{
  28.         echo "error";
  29.         echo var_dump($_SESSION);
  30.         echo "out";
  31.         out($Window);  
  32.     }
  33. }
  34.  
  35. function Out($Window){
  36.     //session_destroy();
  37.     echo $Window;
  38.     if ($Window != "Index"){
  39.         header("Location: " . $GLOBALS["Index"]);
  40.     }
  41.     exit;
  42. }
  43.  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement