Re: Session ?

From: Date: Fri, 07 Dec 2012 20:17:28 +0000
Subject: Re: Session ?
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-319818@lists.php.net to get a copy of this message
On Fri, Dec 7, 2012 at 3:04 PM, Jim Giner <jim.giner@albanyhandball.com> wrote: > > OK - now that I've messed us all up, help me to understand your proposed > solution. I added the ini-set line to my first script. Then I called my > second one and still had the same problem with a missing session var. Is > there a corresponding line I need in the 'called' script? And does it > matter where this line is place within the script? From your response to Sebastian, I'm not sure it will work. They need to be subdomains of the same domain; different domains won't work. However, proceeding with the presumption that the subdomains are under the same SLD (e.g. - apple.example.com and orange.example.com), this should work: <?php // apple.example.com ini_set('session.cookie_domain','.example.com'); session_start(); $_SESSION['foo'] = 'bar'; session_write_close(); ?> Then.... <?php // orange.example.com ini_set('session.cookie_domain','.example.com'); session_start(); echo isset($_SESSION['foo']) ? $_SESSION['foo'] : 'Session failed to transfer.'; ?> -- </Daniel P. Brown> Network Infrastructure Manager http://www.php.net/

« previous php.general (#319818) next »