> Now, if you don't see any session ID appended to the URL, that means SID
> is empty and you're more than likely depending upon cookies. So, you
> need to retrieve the session id and append it to the URL yourself.
>
> <?php
@ session_start();
> $sessname = session_name();
> $sessid = session_id();
>
@ echo $sessid;
>
> echo "<a href=\"server2/page.php?$sessname=$sessid\">Server 2</a>";
> ?>

This works. My second page has the suffix '?PHPSESSID=e6t9tu43j9tj39j...',
that matches the 'echo $sessid' I've added to your script above, so this
part did work. But to test it, I do this in my second page:

<?php
session_start();
$sessid = session_id();
echo $sessid;
?>

$sessid does echo a session_id... but not the one as the one I passed
it!!?!?! And I do see the right SID in the Address bar!

What the ???
Thanks in advance.

Guillaume
P.S.
PHP v4.3.3, with MSESSION v1.21 downloaded 2 weeks ago, thanks :)

-----Original Message-----
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 8:29 PM
To: Guillaume Dupuis
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] msession - giving me a hard time


Guillaume Dupuis wrote:

> This is now my initial page:
>
> <?php
> session_start($_GET['SID']);
> echo SID;
> ?>
>
> And it returns nothing to me.

Heh... okay, let's start over.

 From Server1:

If you create a link like this:

<a href="server2/page.php?<?php echo SID; ?>">Server 2</a>

Do you see the session ID appended to that URL? If you do, then a simple
session_start() on the server2/page.php will be enough to continue the
session.

Now, if you don't see any session ID appended to the URL, that means SID
is empty and you're more than likely depending upon cookies. So, you
need to retrieve the session id and append it to the URL yourself.

<?php
$sessname = session_name();
$sessid = session_id();

echo "<a href=\"server2/page.php?$sessname=$sessid\">Server 2</a>";
?>

Now, you should see a link that has something like PHPSESSID=XXXXX.

Again, a simple session_start() on the next page will continue the session.

So, to recap:

1. Both servers only use session_start().

2. When linking between servers, you must pass the session ID in the URL
using one of the above methods

3. When staying on the same server, it appears the session ID is being
passed around in a cookie, so you don't need to do anything to those links.

Hope this helps some more... :)

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com



>

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

Reply via email to