Re: Curly and annoying. Session vars and uniquely identifying a browser window.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ross Honniball wrote:
Hi all,

I use the php script name as a key in the $_SESSION array to store script specific variables.

The problem with this approach is that if a user fires up multiple browser windows, they share the same $_SESSION data.

So then if they use the same script in two different browser windows, I get this cross-pollution of $_SESSION variable states.

The dream solution to this would be to have some ability to uniquely identify a clients browser window and incorporate this into the $_SESSION key along with the script name.

Does anyone know if this is possible, or alternatively another way of avoiding the issues I am faced with?

You can't distinguish a request from one browser window from another. The browser simply doesn't send anything that distinguishes that. So, if they start one window, hit your site and get to some point in it, then they open another window from that same browser instance and copy the current URL over, that next request is indistinguishable from them just refreshing the first window. You simply need to build your applications such that this isn't an issue. The solution may be to trigger off of some some of entry point, so that they can actually have multiple concurrent sessions from the same browser instance, but each browser window has to enter through a given entry point where you issue a token that your propogate in the URL itself. That way you can key your session data off of that URL token and not rely exclusively on the session cookie since that cookie is browser-instance-wide.


-Rasmus

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux