Getting sessions which are alive

I like to echo all sessions which are alive at the moment.

echo list($session_alive);
The code above doesn’t work correctly but I hope it shows what I want, And the below is the result what I want.

result
session1=1
session2=‘mySession’
session3=‘aaa’
etc;

session1 , session2, and session3 are the session names and “1”, ‘mySession’, and “aaa” are their value;

How can I make the php page echoing all session list which are alive at the moment?

I think it’s impossible (or too complex) with standard PHP sessions mechanism. So you should to save your sessions in RDB and regularly refresh them by any user request. Then you would be able to select not expired sessions

Can it be done? Yes.
Is it too difficult? Not really.
Should you do it? No.

You should probably define your use case a bit better; there are exceedingly few situations in which you would want to access this information.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.