We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10525
    • 247 Posts
    I keep my manager session in one tab, the website in another, I edit snippets in a php editor, switch between these and occasional use of Fireworks or Photoshop. All pretty standard procedures for a developer. But I get tripped up every 2nd or 3rd time I go back to the manager as I have to log in again.

    Is there a way for me to change the expiry time for the manager session?

    Thanks.

    ps - I'm using Evo 1.0.6
      • 10525
      • 247 Posts
      I had a look at my cookies after logging in to the manager. Along with phpsessionId and a few webfxtab_* cookies, the following two stand out because of their expiry dates:

      Name: modx_remember_manager
      Value: admin
      Expires: Sun, 07 Dec 1969 03:28:36 GMT

      Name: SN4fe61ad9*****
      Value: h3896d0ukbom5gvnfm********
      Expires: Sun, 07 Dec 1969 03:28:36 GMT

      Could these be anything to do with my frequent session expiries?

      Any suggestion as to what is happening here and how I can fix these dates?

      Thanks.
        • 10525
        • 247 Posts
        Folks,

        I'm sure somebody out there knows the answer to this?

        I restart my laptop the next day and I'm still logged in to MODx forums, but I get logged out of the MODx manager after about 10-15 minutes.

        Can anybody tell me how to extend this or keep me logged in indefinitely?

        Could this be a server problem with sessions being deleted?


          • 10208 ☆ A M B ☆
          • 1,780 Posts
          Try Whistlemaker's time snippet.

          I've been experiencing this on a new host and I think I may have an idea why thanks to your post here. My information says it's set to EDT in both mySQL and PHP, yet the manager time and the actual time is not three hours ahead of me but more like 13 hours. I'm still unsure of a solution but at least now I see where a discrepancy lies.


          A simple snippet for testing that will display


          • What time php thinks it is
            What time mySQL thinks it it
            What timezones are set for the mySQL server

            and session (if different)
          It assumes you have not moved the core.

          <?php
          
          //get the values we need to log into the mySQL server with
          include 'core/config/config.inc.php';
           
          //php date
          $arr['php'] = date("F j, Y, g:i a");
           
          //mysql
          $link = mysql_connect($database_server, $database_user, $database_password);
          if (!$link) {
              die('Could not connect: ' . mysql_error());
          }
          if (!mysql_select_db($dbase)) {
              die('Could not select database: ' . mysql_error());
          }
          //get the mySQL time
          $result = mysql_query("SELECT NOW();");
          if (!$result) {
              die('Could not query:' . mysql_error());
          }
          $arr['time'] = mysql_fetch_array($result);
           
          //returns the system timezone.
          $result = mysql_query("SELECT @@system_time_zone;");
          if (!$result) {
              die('Could not query:' . mysql_error());
          }
          $arr['systimezone'] = mysql_fetch_array($result);
           
          //returns the session timezone if it differs from the system timezone.
          $result = mysql_query("SELECT IF(@@session.time_zone = 'SYSTEM', @@system_time_zone, @@session.time_zone);");
          if (!$result) {
              die('Could not query:' . mysql_error());
          }
          $arr['sestimezone'] = mysql_fetch_array($result);
          mysql_close($link);
           
          $times = 'php time is: '.$arr['php'].'
          ';
          $times .= 'mySQL time is: '.$arr['time'][0].'
          ';
          $times .= 'mySQL system timezone is: '.$arr['systimezone'][0].'
          ';
          $times .= 'mySQL session timezone is: '.$arr['sestimezone'][0].'
          ';
           
          return $times;
            Frogabog- MODX Websites in Portland Oregon
            "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
            Having server issues? These guys have MODX Hosting perfected - SkyToaster
            • 10525
            • 247 Posts
            Thanks for that Frogabog.

            I tried this and got apparently normal results:
            php time is: June 26, 2012, 11:43 pm
            mySQL time is: 2012-06-26 23:43:28
            mySQL system timezone is: BST
            mySQL session timezone is: BST

            Interestingly, when I tried to save this snippet I got an error:
            Forbidden

            You do not have permission to access this document.
            (I just saved it as a php file).

            Hmmm, what to try next?...
              • 10525
              • 247 Posts
              Just checked and my cookie dates are still exactly the same as before...
              Name: modx_remember_manager
              Value: admin
              Expires: Sun, 07 Dec 1969 03:28:36 GMT

              Name: SN4fe61ad9*****
              Value: h3896d0ukbom5gvnfm********
              Expires: Sun, 07 Dec 1969 03:28:36 GMT

              Is it possible that these have accidentally been left hard-coded for testing and not reverted back to dynamic dates?
                • 10208 ☆ A M B ☆
                • 1,780 Posts
                My session expiration issues are on a fairly new revo 2.2.4-pl install and I have never used evo. Sorrry. I don't even get the 15 minutes. Simply clearing the cache after making a small code change is enough to have to log back in. Mere seconds sometimes.
                  Frogabog- MODX Websites in Portland Oregon
                  "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                  Having server issues? These guys have MODX Hosting perfected - SkyToaster
                  • 10525
                  • 247 Posts
                  That sounds irritating too!

                  OK it's bedtime here in BST. I'll get on to this again tomorrow.

                  Cheers.
                    • 10525
                    • 247 Posts
                    OK, just checked my MODx manager cookies, after a couple of days, and they are now looking more sensible:
                    Name: modx_remember_manager
                    Value: admin
                    Expires: Mon, 01 Jul 2013 08:01:42 GMT

                    Name: SN4fe61ad9*****
                    Value: h3896d0ukbom5gvnfm********
                    Expires: Sun, 08 Jul 2012 08:02:44 GMT
                    Taking into account current Summer Time, the first time is correct, if it is supposed to represent login time, but just a year too far ahead. The second is the correct time but a week ahead.

                    Can anyone tell me what these cookies mean and what they are used for?

                    I am still losing my session every 5 mins and would like to know if this is anything to do with the cookies or something wrong with my server.

                    Thanks.