Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Is there a way to know if another user is logged in?
  • Hi,

    is that possible? I mean, if the script is running anonimously or by another user.
    E.g. can the admin know if one specific user is logged in?

    Thanks. Regards
  • HarroHarro
    Accepted Answer
    What do you define as "logged in"?

    Technically it's not possible. A PHP application is stateless, so every request stands on it's own. Only a cookie that's passed back and forth can create state via the session, by for example re-login a user who's id is in the session.

    In one of our apps, we have "last_login" and "last_seen" columns in the user table, both containing a timestamp. The first is updated at the actual login, the second at each Auth::check() call.

    Using something like that you could for example define "logged-in" as last_seen set within the last 15 minutes.
  • Ok, thanks

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion