Jump to content

PHP SESSIONS AND LOGIN


Divante

Recommended Posts

I have simple website that uses sessions to update user login information as per the database gets updated when they login and also when they logout. Everything works fine until they close the browser window. The database does not get updated so on the admin side it still shows that they are logged in. What i am tryin to accomplish is to detect and destroy the session when they close the browser as well as update their login information in the database.

Link to comment
Share on other sites

what I normally do is have a javascript/ajax with a little timeout (say every 60 seconds so it doesn't use too much resources) that checks if the users are still logged in and saves the time of the last update. whenever it runs, all the users that have not updates for over 65 seconds are considered logged out, the I update the sessions accordingly.

Link to comment
Share on other sites

  • 2 weeks later...

thanks all for the input, i know JavaScript can tend to be unreliable some times especially in cases where its turned off. i have kinda solved the problem by running a cron job once every 3 or 4hrs to remove session data as each login session is unique and will be ended once the browser is closed. Hence i look for those special cases once every 4 hrs. Any additional inputs will be appreciated.

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.