We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8841
    • 42 Posts
    Hi, I’ve added a bit of functionality a modx content management system for a client, its basically a few HTML and PHP pages, is there anyway of protecting the security of these pages within modx?

    I.e. you have to be logged in to gain access to these pages?

    Or do I simply have to add some sort of PHP script to authenticate users on login?

    Thanks,
    Emma
      • 9130
      • 171 Posts
        • 8841
        • 42 Posts
        Thanks, I had a look and I dont think this will work for me

        E.g. I have written a simple html page that links to several php pages

        I want to set it up, so that, if a user tries to access the html page, they will get kicked out unless they are logged into the manager
          • 22303 MODX Staff
          • 10,725 Posts
          No, you definitely can’t authenticate web server requests for html pages through MODx.  Why can you not just put the HTML page in MODx as a page?  Then you’re golden.
            • 9130
            • 171 Posts
            Oh, I did not understand that these are external pages.

            There is no reasonable way to protect html pages (technically apache can do this). I suggest you either turn this page into a php page or move it into MODx as opengeek suggested.

            Protecting php pages is possible, on each page check the session variables and see if there is a user signed into the manager, if not redirect to the login page. Check out this forum thread for details.

            You might also want to consider taking all these pages and integrating them with the modx manager as a module.
              • 8841
              • 42 Posts
              "]Protecting php pages is possible, on each page check the session variables and see if there is a user signed into the manager, if not redirect to the login page. Check out this forum thread for details."


              I think I’ll go for this option, thanks