On topic - Couldn't you just use some sort of encryption? I imagine you could do something with encryption, or an outside program.
If you can make a version of a program that's encrypted, that directly implies that within that program is a way to obtain the unencrypted version so it can be run. It's not possible to prevent a skilled user from figuring out how and replacing the encrypted version with the unencrypted version.
How do you think photoshop keeps getting released online for free even with all it's DRM and stuff in place?
Here, let me prove it.
Let's say you have a program that contains a method.
function doNastyThings()
{
//muahaha
delete C:/
}
And you have an encrypted copy of this program, using whatever algorithm you like.
in order for this program to run it has to decrypt itself and run. So you have a method,
decryptprogram(%program, %key) that does exactly this.
So in your code you now have:
eval(decryptprogram("erovitervtmoertivermclwoeimrtx", "secretkey"));
In order to obtain the unencrypted version of the code, all i have to do is replace
eval with
echo in the code and it'll spit it out.
There are lots of different things you can do to obsfucate and complicate things further but really it just comes down to how determined a skilled user is to reveal the original code. Yeah, nobody here's smart enough to crack photoshop but this ain't exactly assembly code here.