Writing PHP with 'sessioned' and 'unsessioned' behaviour.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Guest

    Writing PHP with 'sessioned' and 'unsessioned' behaviour.

    I'm writing a PHP program that produces two different kinds of output
    depending on whether there is an active session.

    I'm looking for a nice bit of code to do the initial checking.

    This worked with register_global s=On :

    if ($PHPSESSID) { session_start() ; }

    but I'd prefer to run with register_global s=Off . Also, doing
    session_destroy () didn't seem to unset $PHPSESSID.

    I'm currently using 4.2.2, but I'd like to write something that is
    compatible with later releases (if at all possible).
  • Michael Fesser

    #2
    Re: Writing PHP with 'sessioned' and 'unsessioned' behaviour.

    .oO(Chris Guest)
    [color=blue]
    >I'm writing a PHP program that produces two different kinds of output
    >depending on whether there is an active session.
    >
    >I'm looking for a nice bit of code to do the initial checking.
    >
    >This worked with register_global s=On :
    >
    > if ($PHPSESSID) { session_start() ; }
    >
    >but I'd prefer to run with register_global s=Off.[/color]

    The session-ID can be found in the $_GET or $_COOKIE array.

    Micha

    Comment

    Working...