We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33372
    • 1,611 Posts
    Whaaaaaaaaa? Why is that your only option? Can’t you just use a different template for your SSL pages?
      "Things are not what they appear to be; nor are they otherwise." - Buddha

      "Well, gee, Buddha - that wasn't very helpful..." - ZAP

      Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
      • 727
      • 502 Posts
      ’cos you said you didn’t think it would work for forms. A form submission is what I am trying to protect. I’m using eform right now, so submitting the form will reload the same page. smiley

      Andy
        • 33372
        • 1,611 Posts
        Aha. I guess I should’ve been more clear. I meant that I didn’t think the site_url placeholder would work on a shared-SSL setup (although I haven’t actually tried it; it might work fine). The forms themselves should work fine. The only question I had was whether you’d get the right action URL in the form if you use the site_url placeholder there, but you don’t have to do that so it’s not really an issue.
          "Things are not what they appear to be; nor are they otherwise." - Buddha

          "Well, gee, Buddha - that wasn't very helpful..." - ZAP

          Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
          • 727
          • 502 Posts
          I guess I just need to figure out a way of testing a shared-SSL setup on my development server, and then working through the problems but using a seperate template for the SSL pages. Thanks!

          Andy
            • 33372
            • 1,611 Posts
            OK I’ve tested the site_url placeholder on a shared-SSL page and it works fine. I wasn’t sure how that was set, so I was wary of using it. Looks like my wariness was unwarranted.

            So all you have to do is to link to the page using the shared-SSL URL, include a <base href="[(site_url)]" /> tag in your document’s head, and make sure that your form’s action is correct.

            Just don’t count on cookies or sessions from your non-SSL server...

              "Things are not what they appear to be; nor are they otherwise." - Buddha

              "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

              Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              You can pass the session_id in the GET or POST (using a hidden input field in a form, for example) then manipulate your sessions to copy the session data from the original session to the new one.
              if(isset($_GET['s']) && $_GET['s'] != session_id()) {
                $new_session = session_encode(); // save the new (current) session
                $fname = session_save_path() . "/sess_" . $_GET['s']; // get the old session's file
                if (session_decode(file_get_contents($fname))) { // get its data
                  $fields = $_SESSION['fields']; // store what you want in an array
                }
                session_decode($new_session);  // restore the new session
                $_SESSION['fields'] = $fields; // load in the array from the old session
              }

              The "fields" variable is just for example. Grab whatever values you want from the old session file.
              Alternatively, you can just switch session files by setting your session_id to that of the old one passed in the GET or POST. This would only be suitable if your new session doesn’t have anything important in it.
                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
                • 727
                • 502 Posts
                Thanks ZAP and sottwell. I will give this a go when I get a chance. grin

                Andy