Php licensing system

hello I have a problem. I need to make a php application with licensing but I didn’t find anywhere a tutorial or a book about this. I hope that you guys might help me.

I need a complete licensing system for the application so that the user can’t run it without. The system should ask the user for the registration code (or something like that ) while the installation process. The application should not be able to run if the code that takes care of the licensing will be removed.

If you guys can guide me to some books or tutorials that help me with this I would appreciate it.

Thank you.

Zend Guard and [URL=http://www.ioncube.com/]IonCube both do this.

I think IonCube is the best shot in this matter.

I know that but I have to do this manually. Must be hard coded not a software solution provided by someone else. Thus I need to understand how it works so I could develop my own.

and i need a system that not only encodes my php but the are encoded must be critical to the application. Not all the application will be coded, but just the licensing system. The application should not work if the licensing system is deleted.

To be more specific , how do I make the application not work (and will not be made to work) if the license is deleted?

It consists of two parts: An encoder which compiles the php into bytecode and then encrypts it with a proprietary encryption algorithm, and a runtime php-extension, which decrypts the encrypted code and transforms it into bytecode, that is then passed to the php runtime.

Unless you are very familiar with C and have a few weeks to spend on understanding the php runtime system, I don’t think you’ll get very far. And in any case, you face the problem of cross compiling your decoder for each platform you want to support and convince your users to install it on their systems.

As they said, Zend Encoder or IonCube.

There is nothing you can do to develop a licensing system that is not easily circumvented without using those programs (or a less-popular but similar one).

And how about the second question?

how do I make the application not work (and will not be made to work) if the license is deleted?

Because I could encrypt the php as best as I can but if a customer could delete the licensing system and make the application work without that then i’ve done nothing.

Require the license script at the top of all your pages.
Then you encrypt the pages…

If you wanna add a little more user-friendly error than the PHP error that gets thrown if they delete your license script,
then create a file_exists() condition at the top of your scripts. If the file does not exist, then give them a more user-friendly error and exit.

An alternative solution is to not distribute the application, but instead host it yourself. That way, your clients won’t be able to circumvent the licensing system.

You may want to take a look at phpAudit as well.

Yes, I want to make similar things.
I want to keep most of the source code clean and readable.
But it should run only with a license.

I would prefer to make a big file that includes most of the classes and functions used within the entire application. I think, this is the only one file that I will encrypt it, so that the customers cannot remove the code piece that checks for the license.

Nor they cannot change the other class files and methods that are not necessary to change. While everything else works well, the application will not work without loading the encrypted file first (because this contains some libraries already essential to run the application).

Further, there is a little finger back, to see who has used the application. It is done via cURL or loading some image or javascript from the original tracker server.