We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36468
    • 4 Posts
    Hello,

    I have a problem with saving sessions.
    Modx generate in my database table "modx_session" a new record with a new id when I refresh the webpage. This is wrong.

    I use two domains. When I open the webpage by the default domain it works right.
    But when I open the webpage with a domainpointer, it's makes for each refresh a new ID.

    How can I solve this problem?
      • 22303 MODX Staff
      • 10,725 Posts
      PHP sessions are always domain specific, but if your session.cookie_domain ini configuration is set to something other than the HTTP_HOST you are accessing the site with, this could be the source of the problem. You can share sessions across sub-domains of a single domain, but not across different domains.
        • 36468
        • 4 Posts
        Hello opengeek,

        Thanks for your reply but your solution doesn't work.
        I tried to change the session.cookie_domain in the php.ini file and in the modx configuration settings to the domainname of the domainpointer, but both no results.

        The follow output will added in my table modx_sessions:

        When I open the webpage on the default domain:
        modx.user..attributes|a:1:{s:3:"web";a:3:{s:16:"modAccessContext";a:1:{s:3:"web";a:1:{i:0;a:3:{s:9:"principal";i:0;s:9:"authority";s:1:"0";s:6:"policy";a:1:{s:4:"load";b:1;}}}}s:22:"modAccessResourceGroup";a:0:{}s:17:"modAccessCategory";a:0:{}}}webDocgroups|a:0:{}modx.user.contextTokens|a:0:{}veriword|s:6:"Acc782";
        


        When I open the webpage by a domainpointer.
        modx.user..attributes|a:1:{s:3:"web";a:3:{s:16:"modAccessContext";a:1:{s:3:"web";a:1:{i:0;a:3:{s:9:"principal";i:0;s:9:"authority";s:1:"0";s:6:"policy";a:1:{s:4:"load";b:1;}}}}s:22:"modAccessResourceGroup";a:0:{}s:17:"modAccessCategory";a:0:{}}}webDocgroups|a:0:{}modx.user.contextTokens|a:0:{}
        


        Plus a new row:
        veriword|s:6:"Que757";
        


        But the above two codes belongs to each other and have a different ID.
          • 22303 MODX Staff
          • 10,725 Posts
          I don't know what a domainpointer is. If you have different domains accessing the same content, they cannot share the session across both domains, period.
            • 3749
            • 24,544 Posts
            FYI, the veriword $_SESSION variable is set by the Captcha plugin.
              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
              • 36468
              • 4 Posts
              I know that the veriword is saved in the $_SESSION.

              With a domainpointer you can get the same content with a other domain.
              I don't want to share a session from a other domain to a subdomains.

              In my second post you see the first code and it is a session saved in the database, that is one session and exist the veriword. That's good.

              Now we go to the subdomain (the domainpointer).
              In the second code you see one session without the veriword.
              In the third code you see one session with the veriword.
              The second and the third code is one session en belongs togheter.
                • 22303 MODX Staff
                • 10,725 Posts
                Do you have a session_cookie_domain System Setting or Context Setting set? Or is there a session.cookie_domain set in your PHP ini? I cannot reproduce this problem at the moment. Accessing a site by different HTTP_HOSTs is still producing one session per HTTP_HOST in my tests. Perhaps this is an issue with the Captcha plugin.
                  • 36468
                  • 4 Posts
                  I already tried your solution.
                  But do you know which class (php file) add a new row in the table modx_sessions?