session alive across browsers?

rekha's Avatar
Contributor
Hi,


How to keep the session alive across browsers?Suppose I have logged in my site using firefox.If I open IE and give my site,it will be automatically logged in.How to do this?



Regards
Rekha
0
venami's Avatar, Join Date: Dec 2008
Ambitious contributor
I have not heard of such a scenario before. According to my understanding, the session variables are stored in the storage space specific to a particular browser. So I think this is not possible.

Anyways, will let you know if there is a way.
0
technica's Avatar, Join Date: Dec 2007
CoderByNature
No i too agree that this is not possible.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Impossible.
0
sameer_havakajoka's Avatar
Skilled contributor
cookies?
0
venami's Avatar, Join Date: Dec 2008
Ambitious contributor
Cookies are browser-specific. If you use more than one browser in your system, then each browser will have their own set of cookies.
0
pete_bisby's Avatar, Join Date: Nov 2007
Go4Expert Member
It can be done, but you need to know the session key/ID - easiest way is to put the session key/ID as part of the URL (e.g. http://www.a-website.com?id=1a2b3c1a...1a2b3c1a2b3c4d).

You can then use this key in another browser to re-register the session using the existing session key/ID, using session_id() passing the session key/ID as the parameter.

However, revealing session keys/IDs as part of the URL isn't a good idea - goes against all security principles.
0
rekha's Avatar
Contributor
Can you give me a simple example.I can't figure it out what you are exactly telling?Pls...
0
venami's Avatar, Join Date: Dec 2008
Ambitious contributor
I think this is what pete_bisby tries to say:

When you had registered in a web browser, you can get the session ID details from that browser and then use the same session ID to re-register when the user loads the same page in another web browser.

But, my doubt is whether the session is used or another session created with the same session ID? I hope the latter only will happen... Correct me if I am wrong.
0
pete_bisby's Avatar, Join Date: Nov 2007
Go4Expert Member
It actually uses the same session file that is created on the server, effectively sharing the same session variables between two web browsers.

Session variables are not stored on the individual user's computer or the web browser - they are stored on the web server, defined in the PHP.INI file. The file that is created is a simple text file with serialised information, relating to the session variables you define when creating the $_SESSION array. The session key/ID is part of the filename of this text file.

To be honest, I cannot think of any good reason why you want to do this, only that it is possible. It certainly isn't "best practice" to share session keys/IDs, simply because the information stored is supposed to be secure.