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