Re: Session ?

From: Date: Sat, 08 Dec 2012 17:10:29 +0000
Subject: Re: Session ?
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.general 
Request: Send a blank email to php-general+get-319827@lists.php.net to get a copy of this message
On 12/8/2012 11:41 AM, Jim Giner wrote:
On 12/8/2012 11:04 AM, Daniel Brown wrote:
     You can pass the session ID and reactivate the session that way,
sure. Not pretty, and it does lead to security considerations, but it would work.
OK - I've done this in script 1: if (isset($_REQUEST['sess']))
     $sess_id = $_REQUEST['sess'];
else
     $sess_id = '';
if ($sess_id > '') {
     session_start($sess_id);
     $errmsg .= "started sess id is: $sess_id ";
} else {
     session_start();
     $errmsg .= "started new sess ";
} Then my process creates a Session array and calls script 2 In script 2 I have: if (isset($_GET['sess']) && $_GET['sess'] <> '') {
     $sess_id = $_GET['sess'];
     session_start($sess_id);
     $errmsg .= "started sess $sess_id ";
} else {
     session_start();
     $sess_id = session_id();
     $errmsg = "started NEW sess with id of $sess_id ";
} My $errmsg shows me the same sess id in both scripts, and it would appear that I have managed to pass my session across the sub-domains. But when script 2 attempts to access the contents of the Session array created in script 1 it doesn't find it. What am I not doing? Forgot to mention that when I do header(...) to go to script 2 that I do append the session id to my url
Same on the return from script 2 back to script 1.

« previous php.general (#319827) next »