On 8 Mar 2004 Tim Traver wrote:
> I sent a new session ID with the link to the new window like this :
>
> <a href="?PHPSESSID=123456789" target="_blank">
>
> but all it does is change the current session id to the new one, so if I go
> back to the main window, it carries the new session into it.
I think this is trickier than it sounds. Calling session_name with the
new name just prior to calling session_start should do it if you know
what name to set. But where are you going to get the name? If it is
hard-coded you are OK but if it is dynamic, as it has to be with user
logins, you need a place to store the session name -- and you can't use
sessions to do it! You end up having to pass at least something in the
URL, even if it is just a digit:
print("<a href=\"?$sessnum\" ...>");
the URL would be something like:
http://www.mydomain.com/page.php?1
from which you do something like:
session_name("PHPSESSID" . $_SERVER["QUERY_STRING"]);
session_start();
(obviously some error-checking might be beneficial as well).
I don't think you can do what you want with sessions alone. HTTP is
"too stateless" for that!
--
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php