Close session after # of minutes

Results 1 to 3 of 3

Thread: Close session after # of minutes

  1. #1
    Join Date
    Dec 1969

    Default Close session after # of minutes

    I would like to prompt the user after a certian amount of minutes that there session will be closed. <BR><BR>For example: If a user were to have a session open for 3 minutes, a message is displayed asking them if they would like to continue with their session. If there is no response from the user after lets say 5 seconds, the page redirects to a log outpage that closes the session and then a close page that closes the browser. <BR> <BR>The purpose of this is so that if a user logs in and they walk away from their pc, leaving there session open, this script will just close it for them.<BR><BR>thanx in advanced.

  2. #2
    Join Date
    Dec 1969

    Default RE: Close session after # of minutes

    Just set the session timout to 5 mins..<BR>It will reset to 0 every time they call a page<BR>if they dont call a page inside that 5 min window, then it will expire...<BR><BR>Other than that, you will need to use a timer and javascript on clientside (browser)<BR>and pop up an alert or something and take it from there<BR>search the board here, others have done exactly that before so you can get some good material on it im sure.<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default Easy in JS in browser

    &#060;BODY onLoad="setTimeout(&#039;warning()&#039;, 3*60*1000 );"&#062;<BR><BR>and then<BR><BR>&#060;SCRIPT&#062;<BR>function warning()<BR>{<BR> var force = setTimeout( "forceOff()", 5*1000 );<BR><BR> if ( confirm("Continue this sesssion?") )<BR> {<BR> // cancel the 5 second timer<BR> cancelTimeout( force ); // not sure this is right name. check JS docs<BR> // reset 3 minute timer<BR> setTimeout("warning()", 3*60*1000);<BR> return;<BR> }<BR> // user said do not continue, so do this immediately<BR> forceOff();<BR>}<BR><BR>function forceOff()<BR>{<BR> ... submit the form or just close browser or whatever ...<BR>}<BR>&#060;/SCRIPT&#062;<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts