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
https://forums.phpfreaks.com/topic/221875-last-active/
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
https://forums.phpfreaks.com/topic/221875-last-active/#findComment-1148201
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
https://forums.phpfreaks.com/topic/221875-last-active/#findComment-1148257
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.