Announcement

Collapse
No announcement yet.

HOW TO AUTO-LOGOUT AFTER 10 MIN IDLE TIME {HELP}

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

  • HOW TO AUTO-LOGOUT AFTER 10 MIN IDLE TIME {HELP}

    Hi guys,

    I want to auto-logout after 10min idle time, and goto login page.
    would anybody can suggest me how can I do that in SC
    thanks in advance...
    Ahmer

  • #2
    Re: HOW TO AUTO-LOGOUT AFTER 10 MIN IDLE TIME {HELP}

    I dont remenber now the function, but in php there's a function for it.

    Comment


    • #3
      Re: HOW TO AUTO-LOGOUT AFTER 10 MIN IDLE TIME {HELP}

      You need something with a timer. I have been playing with having an app inside one of the widgets on the container type of app. You can set a refresh time in seconds on those widgets. Have it set for like 10 minutes - if it refreshes sooner than that - in the case of a human clicking something that changes and therefor reloads the page, then ignore. If the timer refreshes and the last timecheck was greater than your threshold, then do the logout by calling the app_Login.
      Hope that gives some ideas.
      Peace,
      Jamie

      Comment


      • #4
        Re: HOW TO AUTO-LOGOUT AFTER 10 MIN IDLE TIME {HELP}

        Dear Ahmer,

        this is not a counter with auto-logout after 10 minutes (that would require javascript), but it will redirect the user to the login page (or another form that you like) after the session.gc_maxlifetime is expired AND the session is succesfully purged from the server. (read about how PHP will handle the session garbage for more infornation).

        the session.gc_maxlifetime is in the php.ini setting that you must set.

        So, if you set this PHP setting and use it as timeout, it will redirect the user when the session will expire.

        I put this in the onScriptInit event.
        -----
        if(!isset($_SESSION['sm_global_login'])) {
        sc_redir(all_loginForm,, '_parent');
        }
        ------

        It will chech if the variable will exist and, if not, it redirect to the choosen form (in my case, the form is called all_loginForm)

        Note that sm_global_login is a global variable that must be set. I use the login itself as parameter and I made it global after a succesful logon.

        I hope that this can help you.

        Best regards,
        Giuseppe Giardina.


        Comment


        • #5
          Hi ahmershuja,
          You can use this script to Auto-Logout after 10 minutes of idle time in ScriptCase. (Including keyword and mouse movements). Follow these steps:

          Auto-Logout Example (JavaScript)
          Change idleMax variable if you want more or less minutes of IDLE time. And replace '../LOGIN_APP/' with your login application URL.

          Code:
          echo '
          <script type="text/javascript">
          idleMax = 10;// Logout after 10 minutes of IDLE
          idleTime = 0;
          $(document).ready(function () {
              var idleInterval = setInterval("timerIncrement()", 60000); 
              $(this).mousemove(function (e) {idleTime = 0;});
              $(this).keypress(function (e) {idleTime = 0;});
          })
          function timerIncrement() {
              idleTime = idleTime + 1;
              if (idleTime > idleMax) { 
                  window.location="../LOGIN_APP/";
              }
          }
          </script>';

          Note: Use this code inside a menu that always shows, or insert on the header of all your project applications. This code must be on all your pages.
          Last edited by hirambq; 01-28-2013, 04:43 PM.
          Best Regards
          Hiram BQ

          Comment


          • #6
            please guys i have a login app and a menu app where do i put this java script

            Comment


            • #7
              Perhaps a more pragmatic approach? After log-in set a global access time. In every onload you call a php function to determine delta time (currenttime minus access time). If it exceeds your threshold then logout, otherwise set the globalaccesstime to the current time. If you create small procedure (php method or in the repository) you just need to call 'checktimeout' or whatever. It will not terminate a session on the screen, but as soon as something is changing due to a user action the accesstime is checked and logged out if necessary.
              Last edited by aducom; 04-11-2013, 04:13 AM.
              Albert Drent
              aducom software netherlands
              scriptcase partner, reseller, support and (turn-key) development
              www.scriptcase.eu / www.scriptcase.nl

              Comment


              • #8
                excellent idea to

                Comment

                Working...
                X