Re: Session ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 7, 2012 at 3:04 PM, Jim Giner <jim.giner@xxxxxxxxxxxxxxxxxx> 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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux