I have written a licensing system for my script and now i saved it an file called lic.php in the root folder

I am going to encrypt that with ioncube when giving to a client side
and i will simply include

include "lic.php"

to call the licensing system

But the problem is when i simply include the code

include "lic.php"

the user can directly remove the line to get the script worked
So can some one help me in coding a script inside the lic.php which will make the script to prevent from running if the code i.e,

include "lic.php"

is removed from the file

Note that i will include the line

include "lic.php"

in all the php files in my script


Great Thanks!

Your best bet is to encrypt a few files that will contant some of the code that controls the actual functionality for your php sscript. This way it is not so obvious which specific file contains the licensing system. So lets say you take three scripts from your entire php script you are planning to sell to customers. you encrypt them and also make sure the actual license check file also contains some of the key functionality the the entire script needs inorder to run.

This will make it a bit harder for someone to crack or reverse engineer. Although nothing is fool proof. But as a min you definatly want some code that controls key functionality to be part of the license check file.

Hope this helps you get you on the right track

You can include some of the core functions, database connectivty, global variables and licensing information into that lic.php That way if the file is not included then your script will not work.

As is said is there any algorthiom to verify whether the line
include "lic.php"

Or not please reply :)

@it
Thanks for that let me have a look at that and i will ping you

Thanks :)

@edwinhermann: Ioncubes online encoding is cheaper :)

Also the get_included_files() will print only the required files in file right??

get_included_files() returns an array with the files that were included. So, for example, if you were expecting "licence.php" to be included, then you could use this to check:

<?php
if (array_search("licence.php",get_included_files()) === false) {
  // handle error here
  }
?>

@edwinhermann: Is it possible to open an another file and read using get_included_files ???

Thanks!

Any Updates please??

I'm not entirely sure what you mean from your previous post.

If it's any help, the get_included_files() function only reports files that have been included using include(), include_once(), require() or require_once().

If you read a file normally (e.g. file_get_contents(), fopen() or other similar methods) then they will not show in get_included_files().

Member Avatar for diafol

ionCube online is really cheap. Have you tried it? For the cost of about $5, you could give it a whirl and see if it works. The $5 will go a long way.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.