JoeAtRevolutionUnltd
Programmer
I am trying to create a session timer using jquery. I need to display an alert after 14 minutes, then if there is no response after 30 seconds log the user out and return to the login page. Here is the code I have so far. I can get the first alert to work, it's the second timer that's the problem.
Code:
$("window").ready(function(){
sessionTimer = window.setInterval("sessionAlert()", 10000);
});
function sessionAlert(){
responseTimer = window.setInterval("end_session()", 5000);
var answer = confirm("Your session is going to expire in 30 seconds, click ok to refresh")
if (answer){
<?php session_destroy()?>
window.location = "/";
}
}
function end_session()
{
<?php session_destroy()?>
window.location = "/";
}