Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   session alive across browsers? (http://www.go4expert.com/forums/session-alive-browsers-t20238/)

rekha 30Nov2009 13:53

session alive across browsers?

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?


venami 30Nov2009 14:21

Re: session alive across browsers?
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.

technica 30Nov2009 14:31

Re: session alive across browsers?
No i too agree that this is not possible.

shabbir 30Nov2009 15:14

Re: session alive across browsers?

sameer_havakajoka 30Nov2009 16:08

Re: session alive across browsers?

venami 30Nov2009 18:20

Re: session alive across browsers?
Cookies are browser-specific. If you use more than one browser in your system, then each browser will have their own set of cookies.

pete_bisby 13Dec2009 19:32

Re: session alive across browsers?
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.

rekha 14Dec2009 11:08

Re: session alive across browsers?
Can you give me a simple example.I can't figure it out what you are exactly telling?Pls...

venami 14Dec2009 13:51

Re: session alive across browsers?
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.

pete_bisby 14Dec2009 15:08

Re: session alive across browsers?
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.

All times are GMT +5.5. The time now is 01:24.