views:

48

answers:

3

Is it possible to access data in other users sessions than the sessions which is active with the currently connecting client ($_SESSION)?

If so, how?

+2  A: 

Yes, but it would be a hack. You would have to look at the session storage mechanism and read it directly. I believe it is files by default, stored in /tmp.

If you need to be more precise about it, consider defining your own session storage mechanism and then providing exta hooks to accomplish what you want.

http://www.php.net/manual/en/function.session-set-save-handler.php

gahooa
Regarding defining custom session mechanism, it's an old write-up, but the principles alone should be helpful: http://shiflett.org/articles/storing-sessions-in-a-database
micahwittman
There are easier ways
Pestilence
A: 

you can retrieve the session data by setting the session id:

http://example.com/index.php?PHPSESSID=1234

where 1234 is the session id

A: 

Yes, call session_id() before session_start() and specify the ID you're interested in. The same function also returns the current session ID, which you can log or pass along elsewhere. You can do this multiple times, by closing the session, setting a new ID and restarting. It'll transparently provide access ($_SESSION). Remember to set it back, because it'll update the session ID cookie.

Pestilence