We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22390
    • 11 Posts
    Hi  grin

    I want to limit the cookie lifetime, in the MODx manager,but i can’t make it work, i tried to  change the line 83 in the config.inc.php

    setcookie(session_name(), session_id(), time()+900, MODX_BASE_URL);
    


    For this example i tried that the session lifetime are about fifteen minutes, i look in the page information the cookie data and i see that the cookie Expire time its good, fifteen minutes after that i create de session..

    But the cookie refuses to die, and seems like it’s invincible.

    rolleyes Maybe you can help me

    grin

    P.D i believe that the cookie always is re-created because the confic.inc.php always is included..  huh
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The Manager uses a sneaky trick of requesting an image every few minutes to keep the session active. It’s done with a javascript file, manager/media/script/session.js, and that is loaded in the HTML head of manager/frames/1.php.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 22390
        • 11 Posts
        rolleyes Thanks for your help, but if i remove the include, the manager will be closed after the cookie expire?
          • 3749
          • 24,544 Posts
          I think you might be able to set a timer in a plugin triggered by one of the MODx page events and, everytime the plugin is invoked, check the timestamp to see if x minutes have passed. Then, destroy the session using session_destroy() and send the user back to the login page or wherever.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            The manager login will expire according to the SESSION settings in your PHP.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 22390
              • 11 Posts
              Tnks, for your answers grin, susan are you sure of that?, i change the ini_set cookie lifetime value to 15 seconds and the session never end.. sad

              Maybe, the bobray solution is a good way, shocked
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                The manager uses a cute little javascript to request an image every few minutes, so it keeps the session active.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 22390
                  • 11 Posts
                  laugh Hi Susan, Thnks for your reply, i have already delete the include of session.js, but the session it’s inmortal :p ,maybe is the karma or a ghost in the MODx soul :’(
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Sessions expire on the server when the session garbage collection is run and (randomly) chooses your session as one that is old enough to dispose of.  The client-side session cookies stay alive as long as the browser session is maintained (and the garbage collector doesn’t eat your session).