|
Helping ordinary people create extraordinary websites! |
Client Clones and Server SessionsBy Tony Marston2005-05-06
Introduction The session handling functions in PHP are designed to save state between different requests from the same client. This works well if the client device is accessing the application via a single browser window, but what happens if the user decides to open up several browser windows and attempts to access the same application through multiple windows at the same time? Unless each browser window on the client device can pass a separate identifier to the application running on the web server, they will all be treated as belonging to the same session. This means that the server will not be able to keep the activities in one browser window separate from the other, which may lead to unexpected results. This problem comes to light in those browsers which make it easy for the user to open up a new window which is a complete copy or clone of the current window. The cloned window shows the same URL as the original window, and shares the same browser history and cookie data. The cloning process can be achieved as follows: • In Internet Explorer select File -> New -> Window (or 'Ctrl+N'). • In Opera select a tab -> right-click -> Duplicate (or 'Ctrl+Alt+Shift+N'). It is therefore possible for the user to create several cloned browser windows on the client device, and then to visit different pages within the same application in each of those windows. The user may assume that the activities in one window will not have any effect on the activities in any other window, and may be disappointed to learn that this assumption is incorrect. This type of behavior does not occur with traditional desktop applications as it is not possible to create cloned copies - it is only possible to start up a fresh instance of the application, and each instance will automatically have its own separate memory. Tutorial Pages: » Introduction » Session Identities » Session Names and Session Cookies » Dynamically changing the Session Name » Starting a new session |
|