Re: Domain Redirect - loses session variables



On 9 Oct 2005 10:40:11 -0700, "Chung Leong" <chernyshevsky@xxxxxxxxxxx> wrote:

>Andy Hassall wrote:
>> If you want this to work, you'd need a method of migrating the session data
>> from one domain to the other through some shared data storage.
>
>I think you might have misunderstood the situation described by the OP.
>He said he had purchased a new domain name. Presumbly, the name points
>to the same machine. Unless the web server is set up to have different
>session save-path per virtual host, session data are shared by default.
>In any event, I believe you can override the save-path with ini_set().

In that case he already has the shared data storage.

>The problem here is that cookies--hence session ids--don't travel
>across domains. So you need to manually sync the cookies of the two
>domains. One way to do this is to do a round-trip redirection at the
>very beginning. From domain_1, redirect to a page on domain_2 with the
>session id passed on the URL. This page calls session_id($_GET['SID'])
>and session_start(), then redirect back to the original page in
>domain_1. Now both domains will use the same session id. A simpler way
>is to use an invisible inner frame to initialize the cookie in
>domain_2.

Since the shared data storage is the same PHP session data area, then this is
essentially just a simpler case of what I said - the unique ID passed to get at
the shared data is already the session ID.
--
Andy Hassall :: andy@xxxxxxxxxxx :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
.



Relevant Pages

  • Re: Domain Redirect - loses session variables
    ... session save-path per virtual host, session data are shared by default. ... So you need to manually sync the cookies of the two ... redirect to a page on domain_2 with the ...
    (comp.lang.php)
  • Re: [ANN] flatulent-0.0.1 ascii captcha for the masses
    ... you then redirect to a page with the captcha and a submit. ... For one thing, cookies can be forged. ... Session data need not be stored in a cookie. ...
    (comp.lang.ruby)
  • Re: sessions and security
    ... authentication every time the user needs to get to sensitive data (or ... world can see your session data stored in cookies if you're not using ... that the cookies can be sent from the client to the server only on SLL, ...
    (comp.lang.php)
  • Re: Sessions not being saved
    ... > does not consistently save the session data from page to page. ... > header() to redirect the user to another page. ... The session variables ... > does not redirect when I do this due to me outputting data). ...
    (alt.php)
  • Re: Session data lost in Firefox
    ... Jeremy Epstein wrote: ... > stored as session data. ... On my hosted server using Firefox1 ... Clear all your cookies, start a session, check for ...
    (comp.lang.php)