Page 1 of 1

Continue session without outputting cookie?

Posted: Tue Mar 09, 2010 1:54 am
by Jace
Normally to start or continue a session I use session_start. This reads the Session ID from a cookie, and continues the session if it existed, or creates a new one and outputs the newly created Session ID as a cookie.

However, is it also possible to only read the ID from the cookie, and (if present) continue the session, but otherwise don't create / start a new session? I.e. some kind of session_continue() function, which does not output any headers?

(Oh and I certainly don't want any Session IDs on the URL. In this case need just to read the cookie and continue, or no session at all.)

Re: Continue session without outputting cookie?

Posted: Sat Mar 13, 2010 6:44 pm
by Darhazer
Somethink like:

Code: Select all

 
if (isset($_COOKIE[session_name()])) {
    session_id($_COOKIE[session_name()]);
    session_start();
}