accessing all active sessions

A

Anonymous

Guest
Hi,
In php I want to access name of currently login users.

Whenever a user logins I register its name as:-
$user=$_POST['user'];
session_register("login_user",$user);

My problem is how to access name of all currently login users.

Help Please.

Regards
Devendra
 
Well, you won't be able to do this with sessions alone. There's no way to get all of the current session data, nor would that data be particularly useful to you.

Usually when this is done, it's done with an existing user database. A column is created in the users table called "last_access" or similar, and every time a user accesses a page, this column is updated with the time. Then, to tell which users are online "right now", you just do a simple query: get all users for whom last_access was in the last X minutes. Pretty simple.
 
Hi,
Thanks for prompt and straightforward reply.

Regards
Devendra Chandola
 
Back
Top