I saw this example in php manual page http://www.php.net/manual/en/session.examples.php The example will create a global session for all client. Can I use this example to create some global application for all client, instead of save it to DB or local file. What're the pros and cons of this method? Thanks for any help.
A:
No, this is not possible, or advised. A session is bound to one client, and clients do not share a session.
Ikke
2010-09-21 12:33:47
Actually this is possible if you override default session handling functions. It's just wrong.
Mchl
2010-09-21 12:37:57
sorry, did you try that example? I try it on two different browsers, and the global session work
coolkid
2010-09-21 12:44:03
It might work, but I wouldn't recommend it... to much scope for potential confusion by othe rdevelopers working with the code, potential issues if you update session variables within the wrong scope, and the use of the term "session" for something that is not session-related can lead to a whole world of confusion.
Mark Baker
2010-09-29 08:25:15
@Mark Baker: thanks for comment. Could you write it as an answer so I can accept it :) because I cannot accept a comment as an answer
coolkid
2010-10-04 04:16:54
+1
A:
It might work, but I wouldn't recommend it... to much scope for potential confusion by othe rdevelopers working with the code, potential issues if you update session variables within the wrong scope, and the use of the term "session" for something that is not session-related can lead to a whole world of confusion
Mark Baker
2010-10-04 07:48:24
A:
Yes it is possible by sharing the session id between two clients but sessions are only used to store temporary data of a user. So once a session is destroyed there is no way to retrieve that data.
brain.overflow
2010-10-28 08:15:58