Page 1 of 1

sessions how to check for inactivity

Posted: Sun May 16, 2010 8:15 am
by deepinlife
guys ,
i use this piece of code to check if the page is active , i put it in every page in my project , in a case it has failed , why ?

Code: Select all

 session_start();
                if( !$_SESSION['UserToProcess']  )
                {header("Location: logout.php");}
should i use

Code: Select all

 session_start();
                if( isset($_SESSION['UserToProcess'])  )
                {header("Location: logout.php");}
when the page is active all the variables is lost isn't it so the first case should work ?

Re: sessions how to check for inactivity

Posted: Sun May 16, 2010 10:06 pm
by yacahuma
I use

Code: Select all

  if(!isset($_SESSION['USER']))
        header....