Re: Session ?
| From: | Sebastian Krebs | Date: | Fri, 07 Dec 2012 20:20:44 +0000 |
| Subject: | Re: Session ? | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319819@lists.php.net to get a copy of this message | ||
2012/12/7 Daniel Brown <danbrown@php.net>
> 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.';
> ?>
>
Would be better to put 'session.cookie_domain' into the php.ini. In both
cases: Clear cookies (at least for your site) completely and set
session.auto_start to 0.
>
> --
> </Daniel P. Brown>
> Network Infrastructure Manager
> http://www.php.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
github.com/KingCrunch