Posted by Oli Filth on 04/21/06 17:17
tomhawkins1@gmail.com wrote:
> I need to be able to check remotely whether a user is logged in or not.
>
> My current log in script saves various bits of data to a session
> (including a user id). I need to find out via an admin script which
> users are currently logged in ie their $_SESSION['theuserid'] exists in
> any of the existing sessions.
>
$_SESSION variables are not sharable between PHP instances/sessions.
To get this information, you would either have to parse the contents of
the sessions folder (probably pretty hard to do), or write a customised
session handler, which logs information to a database (setting a flag
in the user's record, for instance). You can then access that database
to find who is logged in/out.
See http://php.net/session_set_save_handler et al.
--
Oli
[Back to original message]
|