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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.