Hi,

i am using setExpirationSeconds() to set the timeout for user. but how to update the timeout timestamp in data base when user session expires automatically due to user inactivity.

Regards,
Nabin

Recommended Answers

All 2 Replies

Can we see some code?

I usually, create a timeout function with jquery and make ajax calls to a php funciton to update the database with any information I need saved.

So, you can create a timer; then when the timer has reached its max value, send ajax call to controller, set status, and send status to model to update database.

Javascript/Ajax is a good way to handle timeouts but don't rely completely on it. you will need some PHP to check the timer as well, sessions and even setting the time in a table is good practice. If JS is disabled then they are free to do whatever they want. You can set a session lifetime as well, session.gc_maxlifetime in your ini file. Default is 24 mins I think.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.