Jump to content

Last Active


isedeasy

Recommended Posts

I would like to add a feature to my site to show when a user was last active (exactally as you have here at PHP freaks). I would like to know the best way to go about this.

 

The method I came up with would be to simply update a value in a column in the users table every time a page is loaded. Now obviously this would work but I can't see it being very efficient as I am basically doing an mysql update every time a page loads.

 

What's the best way to go about this?

 

Thanks

Link to comment
Share on other sites

yeah last login will not be very good at all because of the remember me feature.

 

The site uses memcache so maybe I could cache the last access time and run a cron job to delete the cache add update the database in the early morning?

 

or does that sound like a stupid idea :P

 

I don't want to decrease performance for a 'nice to have feature' but it would be nice to have that feature lol

 

will running an update query every page load put much strain on the server?

Link to comment
Share on other sites

will running an update query every page load put much strain on the server?

 

As long as it is efficient, you won't have a problem.

 

Hell, look at the bottom of these pages... "Page created in 0.03 seconds with 29 queries.". Granted, the MySQL server is its own, but still...

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.