Page 1 of 1

Expired session?

Posted: Wed Nov 02, 2005 1:41 pm
by Ree
How can I easily check if user's session has expired?

Re: Expired session?

Posted: Wed Nov 02, 2005 1:47 pm
by RobertGonzalez
Ree wrote:How can I easily check if user's session has expired?

Code: Select all

<?php
if ( isset($_SESSION['var']) )
{
    //session is active
}
?>
Where var is the name of one of the session vars that was set. Relying on PHPSESSID is not always the best idea because sometimes the SESSID changes to 1 (at least in some of my code it has).

Posted: Thu Nov 03, 2005 5:04 am
by Ree
So simple... Why haven't I thought of this... :oops:

Posted: Thu Nov 03, 2005 5:09 am
by Chris Corbyn
Ree wrote:So simple... Why haven't I thought of this... :oops:
LOL.... I know the feeling :P

Posted: Thu Nov 03, 2005 7:53 am
by RobertGonzalez
Been there, done that. Believe me I have been stumped by simpler..
everah wrote: Why is this loop crashing my script?

Code: Select all

<?php
$x = 10;
while ($x < 100)
{
    echo "Hi There";
}
?>
By the way, the above code is a great way to fill up your screen and watch your scroll scroll bar shrink and shrink and shrink.

Posted: Thu Nov 03, 2005 10:18 am
by Charles256
my personal favorite..in c++..

Code: Select all

for (int i=0;i<5;l++)
{
  do some mad wicked stuff..
}
and could not figure ouyt why it never got out of that loop.... heh