html session timeout in progress bar

I am facing some difficulties while get the proper code to show the session timeout count down in the progress bar in my html page.

Can any one help me in doing this.



I searched over internet and found one example on how can be this done. Here is one simple example - $inactive variable is session expiracy time, e.g. 600 seconds):

function start_onload(){
    var expire_time = new Date().getTime() + 1000*<?php echo $inactive; ?>;
    function countdown_session_timeout() {
        var current_time = new Date().getTime();
        var remaining = Math.floor((expire_time - current_time)/1000);
        var timeout_message = document.getElementById('timeout_message');
        if (remaining>0) {
            timeout_message.innerHTML = 'Session will expire in '+ Math.floor(remaining/60) + ' min. ' + (remaining%60) + ' sec.';
            setTimeout(countdown_session_timeout, 1000);
        } else {
            timeout_message.innerHTML = 'Session expired.';


Php script here: (those sessions are only as example.)

Need Your Help

How to connect Pervasive ODBC using PHP on Windows?

php pervasive

I want to Connect Pervasive ODBC using PHP on Windows. Wether we have to download Pervasive client version for same? Whats else we need to download for this?

Why does setDistributeEvenly fail when using a custom tab layout within a SlidingTabLayout?

android android-layout tabs android-custom-view

I am using SlidingTabLayout with my own custom tab layout. Everything works as expected; the tabs show up properly (titles, order, colors, and so forth), however, setDistributeEvenly does not work...