Posted by C. on 09/24/07 20:51
On 24 Sep, 20:58, "laredotorn...@zipmail.com"
<laredotorn...@zipmail.com> wrote:
> Hi,
>
> I'm using PHP 4.4.4. I have two domains --www.mydomain1.comandwww.mydomain2.com. Both point to the same IP address. I have two
> pages on that IP -- first.php
>
> <?php
> session_start();
> $_SESSION['test'] = "hello";
> ?>
>
> and second.php
>
> <?php
> session_start();
> print $_SESSION['test'];
> ?>
>
> What I would like is when I first visithttp://www.mydomain1.com/first.php
> and then visithttp://www.mydomain2.com/second.phpto have the word
> "hello" printed. Does anyone know how to adjust the above scripts or
> my environment to make this possible?
>
> Thanks, - Dave
I'll assume you're using cookies for sessions. In which case the
question is how you get a cookie from one site set when you are
accessing another.
The solution is to suck in pages from both mydomain1 and mydomain2 at
the point where the session is established. This could be done with
frames or by redirection. Life's probably a lot simpler if you pass
across the generated session id from one to the other, but you need to
be wary of session fixation. Otherwise you'll probably need to write
your own session handler to maintain 2 sessions alive and in sync.
HTH
C.
[Back to original message]
|