0

I have set session timeout value 5 mins(300 sec). Below is the code.

if(isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 300)) {
  // last request was more than 5 minates ago
  session_destroy();   // destroy session data in storage
}           

$_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp

I have a form and it will take more than 5 mins to filled it. When user submit it session get expired.

How I can maintain the session expiration time at the time of filling a form?

Sachin
  • 1,273
  • 5
  • 16
  • 27
  • Does this tend to pose some light on your issue: http://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes – Sudhir Bastakoti Jan 24 '12 at 06:58

1 Answers1

0

You can send an ajax call to the server via one of the many javascript events associated with your form.

mowwwalker
  • 16,634
  • 25
  • 104
  • 157
  • Thanks, as I understood I have to send ajax call when click on submit. And set this `$_SESSION['LAST_ACTIVITY'] = time();` then after submit a form. I will try this. Thank you. – Sachin Jan 24 '12 at 08:42