We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25551 ☆ A M B ☆
    • 1,231 Posts
    I was wondering if it was possible to encrypt your PHP in modx so that if you were to create a site for a client, that they would not be able to decipher your work very easily but still work with modx? Does modx snippets still run if the code is encrypted? I was wondering as someone may only want to pay for a managed site but if they wanted the full custom code to work with that you could then supply them with the unencrypted code?
      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
      AugmentBLU - MODX Partner

      BLUcart - MODX Revolution E-Commerce & Shopping Cart
      • 3749
      • 24,544 Posts
      It’s certainly possible, but I don’t think it’s very practical. You’d have to build in on-the-fly decryption of the code and it would create a lot of maintenance headaches for you. You could also just write a module or snippet that would compress all the PHP code and make it very hard to read, but a savvy client could easily run it through a code beautifier and undo the compression.

      Doing either one also leaves your client in a very bad place if you get hit by a bus.

      I’ve yet to see a client that *wants* to deal with PHP code at all. wink
        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
        • 25551 ☆ A M B ☆
        • 1,231 Posts
        I read something (not here) that a developer had sold a web site design to a client but not the rights to their backend custom code. The code was encrypted so the client could not go off to another developer and "steal" their custom work. I know that sounds rather unethical but some people might want to take your hard work without actually paying for the time and effort.

        If you created a website in modx, you leave the default code etc intact and the client is free to bring someone else in to develop that side as they pleased, but is it fair that a new developer has access to your work that you might be using on several other sites that has taken a year to develop? I’m just wondering in an extreme case of a developer wishing to keep code that has taken a long time to develop and wish to use only for themselves but not putting a license on it, rather a sign over fee if you wish to have the rights to the custom work on your site. I don’t know much about the legal side of it all but wondered what people do if they do not wish their custom work to be plagiarised by a 3rd party.
          Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
          AugmentBLU - MODX Partner

          BLUcart - MODX Revolution E-Commerce & Shopping Cart
          • 26903
          • 1,336 Posts
          Try this link http://www.seocompany.ca/software/free-encryption-software.html, there are a few tools here, the Zend stuff looks good and I’m sure I’ve heard of the Turck MM Cache before, though not for encryption.
            Use MODx, or the cat gets it!
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Keep in mind that MODx itself is GPL, so its code must be made available to any of your clients that want it. Your own custom snippets/modules/plugins, however, are another story. Unless, of course, you actually copy bits of the MODx source code for your custom work then they also must come under the GPL. But if they’re all your own code, they’re yours.
              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
              • 3749
              • 24,544 Posts
              I guess you could always write the code in C or C++ and use CGI. wink
                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
                Indeed. Snippets, modules and plugins can all be done with a single line including whatever code files you want. PHP can be used to run most other languages, even shell scripts.
                http://il.php.net/function.exec
                http://il.php.net/function.shell_exec
                http://il.php.net/function.system
                http://objectmix.com/php/427945-c-integration-php.html
                http://php-java-bridge.sourceforge.net/pjb/
                  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
                  • 7231
                  • 4,205 Posts
                  This can be done...but I would never work with anyone who handed me encoded files. I have been trying to debug a script that relies on a 3rd party app that is encoded and I am thinking of starting a new policy to not touch encoded apps...it is a nightmare!!! So if you were to do this with MODx and the client were to hire another person (or do it in-house) this would most likely weigh against you.

                  As far a people steeling your code...that is just part of the world...be it coding, composing, writing, designing...once it is out into the world it can be copied. Imagine buying a book that you could only read with special glasses so that only people who bought it could read it...this would get annoying very fast.
                    [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                    Something is happening here, but you don't know what it is.
                    Do you, Mr. Jones? - [bob dylan]
                    • 25551 ☆ A M B ☆
                    • 1,231 Posts
                    I was just interested to see if encrypted php would work with modx... would it affect the performance of the site at all?
                      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                      AugmentBLU - MODX Partner

                      BLUcart - MODX Revolution E-Commerce & Shopping Cart
                      • 26903
                      • 1,336 Posts
                      If your encrypting/decrypting there will to be some overhead over not doing this but this may not be noticeable, depending on your hardware/platform/method chosen/size of encrypted files etc. You need to implement a scheme and trial it. If for example you are using an opcode cache mechanism on a server you will probably only decrypt the file once, on first load, from then on it wont matter that its encrypted.
                        Use MODx, or the cat gets it!