Jump to content

Cron Jobs + Log In System


pengu

Recommended Posts

PHP + MySQL

 

This has been doing my head in, it has to be possible how I think it is.

The thing I am trying to achieve here is let's say a list of users logged in.  Now if every one would click logout and use the system correctly the world would be a better place, but they wont, we all know this.  So I was thinking how to counter this and I came up with an idea, lets say in our users table we have an "ACTION" field as a timestamp (or datestamp??).  So everytime the user does anything on my site, edit there profile, browse something etc etc, it updates the "ACTION" field to the current time.

 

I was thinking in the background I could have a cron job run every.. 5 minutes?  Is it possible to have it check EVERY users ACTION field and if there ACTION field is less than the current time - 5 minutes, it updates there LOGGED_IN field to like 0, which would mean they're actually not logged in anymore and would not appear in the logged in list.

 

Someone tell me yes or no!

(The main problem being having to constantly update that ACTION field)

Link to comment
https://forums.phpfreaks.com/topic/213259-cron-jobs-log-in-system/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.