Announcement

Collapse
No announcement yet.

Database connection timeout

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

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

    Comment


    • #3
      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.

      Comment


      • #4
        How to fix database connection TimeOut using SC

        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.


        Code:
        [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/
        Best Regards
        Hiram BQ

        Comment


        • #5
          Originally posted by hirambq View Post
          How to fix database connection TimeOut using SC

          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.


          Code:
          [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/
          hello
          is this tested and valid?
          will it override the php.ini settings?

          Comment


          • #6
            Originally posted by MikeDE View Post
            is this tested and valid?
            Looks absolutely valid to me. :-)

            Originally posted by MikeDE View Post
            will it override the php.ini settings?
            Whatever comes first.

            jsb

            Comment


            • #7
              A big plus for Hiram BQ. I've added it to the faqs on scriptcase.eu
              Albert Drent
              aducom software netherlands
              scriptcase partner, reseller, support and (turn-key) development
              www.scriptcase.eu / www.scriptcase.nl

              Comment


              • #8
                Originally posted by jsbinca View Post
                Looks absolutely valid to me. :-)


                Whatever comes first.

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

                thanks also Albert and hirambq

                cheers

                Comment

                Working...
                X