Re: Re: session_exist() ?? Can this be done?

From: Date: Mon, 05 Apr 2004 20:18:29 +0000
Subject: Re: Re: session_exist() ?? Can this be done?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-182403@lists.php.net to get a copy of this message
Hi, just on a side-note, the session is not always kept in a cookie ( if cookies are deactivated the session is saved in the _GET or _POST variables. A check for $_REQUEST[session_name()] might help you some more but can be exploited quite fast eg: index.php?SID=foo I guess the best way to solve your problem would be to set a _SESSION variable on creation and check for it's presence if ( isset ( $_SESSION['session_activ'] )
    AND $_SESSION['session_activ'] === TRUE ) {
// session runnning } else { // no session running } -- red [...]
Thanks, Aaron, I tried this method and it appears to work just fine. Here's a simplified version of what I'm doing: if (isset($_COOKIE[session_name()])) {
    session_start();
        if ($_SESSION['loggedin'] <> 'yea_baby';
        session_destroy();
        $_SESSION = array();
        // Return to log-in page to re-authenticate.
        header("Location:/login.php");
    }
[...]


« previous php.general (#182403) next »