Re: Distinguishing between multiple browser windows for thesame php session

From: Date: Sat, 03 Sep 2005 11:21:19 +0000
Subject: Re: Distinguishing between multiple browser windows for thesame php session
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-221807@lists.php.net to get a copy of this message
""Chris Stenton"" <jacs@gnome.co.uk> wrote in message news:1E.75.33268.87289134@pb1.pair.com... >> Gustav Wiberg wrote: >>> <?php echo $_SELF;?> ? >> >> Please don't top-post [1]. >> >> This will not work. $_SELF isn't even a defined variable, unless you >> defined it yourself. >> >> PHP works on the server, *before* anything is sent on the client, so it >> has no way to know client-side things like what browser window you are >> in. >> >> You could place the value in a hidden form field with JS and then post >> back to the server, but something tells me you may be approaching the >> problem in the wrong way. Without more details I can't suggest >> alternatives, though. > > My problem is that I have a database system where I have a form to define > a > search pattern of the database > which gets placed in session_vars. The user then can use a whole bunch of > php pages to work with this search criteria. > > My problem is that if the user does "file new window" in the browser s/he > can then define a new search pattern which > would change the session_vars behind the back of the other window and > cause > havoc on that window. On the server side, asign any new search, either from the same window or a new one, a 'search id', if you will, which you can send back to the server and allows you to identify each search. This search id, a random number, might index an array containing each search request and the whole array stored as in the session data. > I really don't want to > put the search criteria as part of the URI between all these pages and use > GET to pull the data off as the user > could fiddle with the line and again cause problems. At least a session id, being a random number long enough instead of a sequential number, would be cryptic enough that the user would probably not dare touching it and those who do know would know they better don't even try. Satyam

« previous php.general (#221807) next »