Welcome Guest, Not a member yet? Register   Sign In
setting session time out
#4

[eluser]jrtashjian[/eluser]
@noctrum: I assumed it was using php sessions, however you are correct in saying it uses cookies.
@Volkscom: I would create my session, somewhat like what I have below.

Starting the session:
Code:
function session_create()
{
    session_start();
    
    // timeout in 60 seconds
    $timeout = 60;
    
    $_SESSION['timeout'] = time() + $timeout;
}

Checking if the session has timed-out
Code:
function session_timed_out()
{
    if( time() > $_SESSION['timeout'] )
    {
        session_destroy();
        return TRUE;
    }
    return FALSE;
}

Use it like so:
Code:
session_create();

if( session_timed_out() )
{
    // do something if the session is no longer valid (timed-out)
}
else
{
    // continue the script because the user session is still valid
}


Messages In This Thread
setting session time out - by El Forum - 11-03-2010, 06:28 AM
setting session time out - by El Forum - 11-03-2010, 10:16 AM
setting session time out - by El Forum - 11-03-2010, 10:27 AM
setting session time out - by El Forum - 11-03-2010, 11:42 AM
setting session time out - by El Forum - 11-05-2010, 05:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB