Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Handling redirect URL when session is timeout
  • Hi there,

    Is there any way to know which user is session timeout or not?

    This is because there are some users that they have to be logout to different URL.

    I am using Simpeauth to handle authentication.

    So, if I can do that with it, I would like to know that

    Thank you.
  • HarroHarro
    Accepted Answer
    There is no mechanism to detect a user timeout, such a timeout doesn't exist. The login times out simply because the session times out, and when that happens, the session is gone. You might be able to access expired sessions in the database, but due to garbage collection, that isn't fool-proof too.

    We have one app that uses an additional timestamp field in the user record, that is updated on every Auth::check() call, so you can query the users table, for example for users that haven't done a pageload in the last 15 minutes. So it is not related to the session.

    You could use a similar method but find another way of updating the timestamp, so you can call Auth::check(), and if logged in, get the users last active timestamp. If that is longer ago than your timeout, call Auth::logout() and redirect to your URL, if not, update the timestamp.
  • Hello there,

    Thank you for your quick reply.

    Yes, that is what I expect actually.

    I will think about how to handle this mechanism.

    Thanks,

Howdy, Stranger!

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

In this Discussion