/ Published in: PHP
The best solution is to implement a session timeout on your own. Use a simple time stamp that denotes the time of the last activity (i.e. request) and update it with every request:
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// last request was more than 30 minutes ago } /* You can also use an additional time stamp to regenerate the session ID periodically to avoid attacks on sessions like session fixation: */ // session started more than 30 minutes ago session_regenerate_id(true); // change session ID for the current session an invalidate old session ID } //note that session.gc_maxlifetime should be at least equal to the life time of this custom expiration handler (1800 in this example).
URL: http://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes