Database connection timeout

After deploy my application on Linux(which is Ubuntu 14.04), and use properly without problem.

But when I open an webpage and keep it there for about 2 hours, it’s connection time out, and click any page, gets the “connection time out error”, and goes nowhere, except go to the address bar and re-type the login address.

I want to redir directly to login when the connection is time out, could that be possible?

Thank you very much.

I have the same problem. Also how can we change this time-out time? which timeout time is that?

I don’t think we shoud change the time-out time, because the end-user could lay that web-page for a whole day or two, just code it redirect to login page is best.

[SIZE=5]How to fix database connection TimeOut using SC[/SIZE]

Here is an example to fix timeout. This javascript code will show a message and redirect to login page after xxxx minutes of inactity (mouse/keyword).

  1. You need a SC menu,
  2. add on the layout header a variable value [idle]
  3. place this code onApplicationInit of your menu.


[idle]= '<script type="text/javascript"> 


var inactivityTime = function () {
    var t;
    window.onload = resetTimer;
    document.onmousemove = resetTimer;
    document.onkeypress = resetTimer;


    function logout() {
        alert("Your session has end, please login again.") 
        location.href = "http://bing.com"; // EDIT THIS LINE
    }


    function resetTimer() {
        clearTimeout(t);
        t = setTimeout(logout, 60000) // EDIT THIS LINE
        // 1000 = 1 second
       // 60000= 1 minute
       // 3600000= 1 hour
    }
};

inactivityTime();
 
</script>';

Notes:

  1. On the Logout() function replace the URL and message
  2. change resetTimer with the minutes to redirect after xxx minutes of inactivity.

Here is a live example http://jsfiddle.net/hirambq/jpxmoe7q/2/

[QUOTE=hirambq;30717][SIZE=5]How to fix database connection TimeOut using SC[/SIZE]

Here is an example to fix timeout. This javascript code will show a message and redirect to login page after xxxx minutes of inactity (mouse/keyword).

  1. You need a SC menu,
  2. add on the layout header a variable value [idle]
  3. place this code onApplicationInit of your menu.


[idle]= '<script type="text/javascript"> 


var inactivityTime = function () {
    var t;
    window.onload = resetTimer;
    document.onmousemove = resetTimer;
    document.onkeypress = resetTimer;


    function logout() {
        alert("Your session has end, please login again.") 
        location.href = "http://bing.com"; // EDIT THIS LINE
    }


    function resetTimer() {
        clearTimeout(t);
        t = setTimeout(logout, 60000) // EDIT THIS LINE
        // 1000 = 1 second
       // 60000= 1 minute
       // 3600000= 1 hour
    }
};

inactivityTime();
 
</script>';

Notes:

  1. On the Logout() function replace the URL and message
  2. change resetTimer with the minutes to redirect after xxx minutes of inactivity.

Here is a live example http://jsfiddle.net/hirambq/jpxmoe7q/2/[/QUOTE]

hello
is this tested and valid?
will it override the php.ini settings?

1 Like

Looks absolutely valid to me. :slight_smile:

[QUOTE=MikeDE;37156]
will it override the php.ini settings?[/QUOTE]

Whatever comes first.

jsb

A big plus for Hiram BQ. I’ve added it to the faqs on scriptcase.eu

[QUOTE=jsbinca;37164]Looks absolutely valid to me. :slight_smile:

Whatever comes first.

jsb[/QUOTE]

since looks valid to you then it is surely valid :slight_smile: thanks jsb

thanks also Albert and hirambq

cheers