php - Session Expire And Decrease User Status -



create user auth , limitation login (just 2 user can login in same time ) , of things right
when ever session cookie die ( after x time ) , users_status ( in database ) not change ( decrease -1 )
it's meant :
1 - 2 users login website

session_set_cookie_params(60,"/"); // 1 minutes

2 - if user click on logout ( it's fine )
if user waiting , session die , ( user actuley in database not logout )
there way decrease-1 users_status in database !?

thanks helps , sorry poor :( english.

when cookie expires, server not know it. can store active sessions in database or caching solution (like memcache) life times (ttls). can have cron job, checks expired sessions (for instance, once per minute) , decrease must decreased.


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -