Consider it as the user will login and only giving 45 minutes. How to call a PHP function which is log-out when the Jquery timer runs to 0.
Here's my Code
<script type="text/javascript">
function startTimer(duration, display) {
var timer = duration, minutes, seconds;
setInterval(function () {
    minutes = parseInt(timer / 60, 10)
    seconds = parseInt(timer % 60, 10);
    minutes = minutes < 10 ? "0" + minutes : minutes;
    seconds = seconds < 10 ? "0" + seconds : seconds;
    display.text(minutes + ":" + seconds);
    if (--timer < 0) {
        timer = duration;
    }
}, 1000);
}
 jQuery(function ($) {
var FortyMinutes = 60 * 45,
    display = $('#time');
startTimer(FortyMinutes, display);
});
</script>
And here's my php function
        public function logout() {
        session_destroy();
        redirect('Authentication');
        }
 
    