Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Active field in the user table
  • Hi everyone,

    Is it possible check by active field in users table when user perform login ?


  • HarroHarro
    Accepted Answer
    The column "last_login" contains the timestamp the user logged-in the last time.

    PHP is a stateless language, so technically there is no such thing as "active". You could record the last request timestamp, for example using a "last_active" column in the user table and an "after_load" observer that updates that column on every access of the user record.

    Alternatively, you could extend the Session class and add a userid column to the session table, and have the session class store that data on save. Then you could query the session table to get the last active timestamps of users.

    If you then define "active" as "have requested a page in the last 15 minutes" you could construct something that can show you active users...
  • Thank so much Harro , your answer helped me a lot.

Howdy, Stranger!

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

In this Discussion