Colin McKinnon wrote:
Hi all,
The title says it all - I'm doing sessions with cookies. I can divide
the data within the session easily enough but I can't see when the
user creates a new window or closes an old one.
This is something out of your control. PHP being serverside you just
have to accept the fact that clients with their array of browsers and
software will be requesting your pages from the server handling them
clientside in which ever way they prefer. Some browsers can instantiate
new windows, others might do it in another manner. Your server or the
script has no way of controlling that or even knowing if it is happening
or not.
Through javascript you could make some complicated scripts that interact
with PHP when the client opens new windows or does some wacky stuff, but
this just _might_ work in the mainstram browsers after a lot of work and
experimenting, and even then just turning off javascript would destroy
it. Relying on javascript or any other hacks like this should be
strongly discouraged.
Programming for the web has its limitations, or rather, requires a
different way of thinking than the common clientside programming.
It would help if you told in more detail what it is that you are really
trying to do. If you wish to have the same client operating the
script(s) with many browsers/windows/accounts at the same time, you
might need to start carrying some kind of unique id's with all pages
manually instead of sessions (since they get shared with different
windows of the same browser). This might not be as big of a deal as you
might think (output buffering, includes and perhaps a class doing the
stuff automatically might be something to take a closer look at).
--
Suni