|
Posted by David Gaudine on 01/10/06 22:45
(This is a bit like the recent thread "PHP Switching Sessions".)
I use session_start(). When I open my web-based application in two windows
on the same system, there's a definite clash; I can't do two independent
sessions because the session variables are shared. I solved that
the easy way, by not opening two windows. But then I went on to write
more applications, and found that if I use the same variable names
(for session variables) in different applications I get that same
clash. That I couldn't live with. Now I do this;
session_name ("name_of_application");
session_start ("");
which seems to protect the applications from each other. Questions:
1) Is this likely to really work? It seems to, but I could just be
testing it badly.
2) Is this likely to cause nasty side-effects, like giving every
user (on different computers) access to the same named session?
It looks OK so far, /var/lib/php4 still has random-looking
filenames; I was afraid the session files would be named
"name_of_application".
3) If this works, what about the case where both windows are the same
application? I can't just use "name_of_application", and I can't
just use a random session name since the various php files wouldn't
know the session name. I considered passing the session name
in the URL, but that could cause a problem if a page other than
the base page is bookmarked.
Any thoughts?
David
Navigation:
[Reply to this message]
|