Sometimes you will want to only encode certain files in your project. This can occur if you are using third-party publically available libraries, or if you want users to be able to edit parts of your code. However, if you encode your selected files with include file protection active and attempt to include an unencoded file, it will refuse to run. Fortunately, there is a workaround available which allows you to utilise both include file protection and include unencoded files, which is why in this tutorial, we will be looking at how to set this up.

 

The Workaround

The workaround involves creating another file between the encoded and the unencoded files. This file will be encoded, but will not have include file protection active. It will however share a property with the encoded files. This will override the include file protection, and allow the new file to act as a bridge between the encoded and unencoded files.

 

Setup

First, we will create three files. The first will represent the encoded files with the include file protection active. The second will represent the bridge between the encoded and unencoded files. The third will represent the unencoded files.

1

2

3

 

Next, we want to create two projects. One for most of our files that we want to encode with include file protection, and the other to encode the one bridge file without include file protection. Encode the first project, but not the second.
Now comes the important part. In the first project, we want to gain access to the command line options that the GUI will pass to the command line Encoders. This can be accessed by choosing the “Project” > “View Encoder Command Line” menu item.

 

4

The part of this that we are trying to access is the part that specifies a property called “include_key_property”. Note that the GUI will pass this in with two options, include-if-property and property. We are interested in the one that is passed in with property. Copy this and paste it somewhere safe. The part that you wish to copy is highlighted below:

5

Now, we want to access the command line options for the second project. Once these are open, we want to paste the property we copied earlier onto the end of these options. You will want to ensure that it is pasted onto the same line as the rest of the options, and ensure that there is a space at the end of the options before pasting it in.
Once we have our modified command line option, copy the entire command line option. Open a command prompt, right click on the created window and press “Paste”. This will copy the command line options into the command prompt. Press enter to run the encoder and encode your second project.

6

You should now have everything set up. Place the three files somewhere you can run them on your server, then attempt to access “Include 1.php”. If you have followed the steps correctly, the messages that we were echoing in the files should be displayed properly.

 

7

Using this same technique of creating a bridge file to include unencoded files into encoded files, we now have much greater control over which parts of the code we want to encode and which we do not.

Mixing Encoded and Unencoded Files
twitterlinkedinmail