Page 1 of 1

php sessions

Posted: Mon Aug 27, 2007 10:06 am
by manjit.kool007
hi,
i have pages in which users logins using sessions.
I want to see all the session that have been created using a function or code.. can any one help me?

Posted: Mon Aug 27, 2007 10:10 am
by xpgeek

Code: Select all

print_r($_SESSION);

Posted: Mon Aug 27, 2007 4:05 pm
by feyd
There is no one function that can show you all the sessions currently active.

Posted: Mon Aug 27, 2007 4:23 pm
by AKA Panama Jack
Actually there is a way. You have to create your own session handler and store the sessions in your own directory or a database. Then you can easily view the active sessions and session data.

Posted: Mon Aug 27, 2007 4:25 pm
by VladSun
Maybe it can be done by using the session storage ...


E.g.

Code: Select all

ls /tmp/sess_*
will return all active sessions stored as sess_* where * is for session ID.

Posted: Mon Aug 27, 2007 4:27 pm
by feyd
Those aren't guaranteed active but potentially active.

Posted: Mon Aug 27, 2007 4:28 pm
by VladSun
AKA Panama Jack: 1 minute earlier ;)

Posted: Mon Aug 27, 2007 4:28 pm
by VladSun
feyd wrote:Those aren't guaranteed active but potentially active.
What is the difference from server-side view?

Posted: Mon Aug 27, 2007 4:39 pm
by feyd
If they are stale, PHP will not use them. Plus, you could potentially have multiple server sessions in there (in a shared host environment.) This is why database sessions are preferred.

Posted: Mon Aug 27, 2007 4:48 pm
by VladSun
VladSun wrote:Maybe it can be done by using the session storage ...

E.g.
Just an example - it's not supposed to cover all of the storage methods ... I've never said use file-based session storage instead of DB-based session storage ...

I posted it in contrast of your answer
feyd wrote:There is no one function that can show you all the sessions currently active.
to the question
manjit.kool007 wrote:I want to see all the session that have been created using a function or code.. can any one help me?

Posted: Mon Aug 27, 2007 5:00 pm
by VladSun
feyd wrote:Those aren't guaranteed active but potentially active.
And that was ambiguous - I understood it as you didn't agree neither with me, neither with AKA Panama Jack ...