Example #1
0
echo 'using, ip addresses, domains, mac addresses.<br />' . "\r\n";
echo '<span style="font-size: 10;">' . "\r\n";
echo '<b>Oliver Lillie, buggedcom [publicmail at buggedcom dot co dot uk]<br />' . "\r\n";
echo '<a href="http://www.buggedcom.co.uk/" target="_blank" style="color: #F00">http://www.buggedcom.co.uk/</a></b><br />' . "\r\n";
echo '</span>' . "\r\n";
echo '<b>########################################################################</b><br /><br />' . "\r\n";
echo '</span>' . "\r\n";
# import the classes
include_once '../shared/class.license.lib.php';
include_once 'class.license.app.php';
include_once 'class.license.gen.php';
# initialise the class
# note for this demonstration script we will turn off mcrypt usage
# as some systems do not have it installed in their setup.
# the initial argument usually defaults to true (use mcrypt)
$architect = new license_architect($file, false, true, true, true);
# set the server vars
# note this doesn't have to be set, however if not all of your app files are encoded
# then there would be a possibility that the end user could modify the server vars
# to fit the key thus making it possible to use your app on any domain
# you should copy your server vars in the first line of your active script so you can
# use the unmodified copy of the vars
$architect->set_server_vars($server_array);
# add some data vars
# remember that the reserver variable names in the data is _PHP_OS and _PHP_VERSION
$data = array();
$data['MAX_UPLOADS'] = 10;
$data['WATERMARK_IMAGES'] = true;
$data['COPYRIGHT_TEXT'] = 'This project is copyrighted to FooBar Limited 2005.';
# work out secs in two weeks
# NOTE: an important thing to remember for this example. Although we are
Example #2
0
echo 'This file is a demonstration file that illustrates how to generate a key file on the client server<br />' . "\r\n";
echo '<span style="font-size: 10;">' . "\r\n";
echo '<b>Oliver Lillie, buggedcom [publicmail at buggedcom dot co dot uk]<br />' . "\r\n";
echo '<a href="http://www.buggedcom.co.uk/" target="_blank" style="color: #F00">http://www.buggedcom.co.uk/</a></b><br />' . "\r\n";
echo '</span>' . "\r\n";
echo '<b>########################################################################</b><br /><br />' . "\r\n";
echo '</span>' . "\r\n";
# import the classes
include_once '../shared/class.license.lib.php';
include_once 'class.license.app.php';
include_once 'class.license.gen.php';
# initialise the class
# note for this demonstration script we will turn off mcrypt usage
# as some systems do not have it installed in their setup.
# the initial argument usually defaults to true (use mcrypt)
$architect = new license_architect($file, false, true, true, true);
# set the server vars
# note this doesn't have to be set, however if not all of your app files are encoded
# then there would be a possibility that the end user could modify the server vars
# to fit the key thus making it possible to use your app on any domain
# you should copy your server vars in the first line of your active script so you can
# use the unmodified copy of the vars
$architect->set_server_vars($server_array);
# generate a key with your server details
$gen_key = $architect->generate('localhost', 0, 606024752);
# $gen_key 	= $architect->generate('buggedcom.co.uk', 0, 606024752);
$key = $gen_key == 'KEY_EXISTS' || $gen_key == 'WRITE_TARGET_404' || $gen_key == 'WRITE_TARGET_UNWRITEABLE' || $gen_key == 'WRITE_FAILED' || $gen_key == 'DOMAIN_IP_FAIL' || $gen_key == 'SERVER_FAIL' ? false : $gen_key;
# validate the generated key and get the data
$gen_data = $architect->validate($key);
echo '<b>########################################################################</b><br />' . "\r\n";
echo '<b>Server Generated License Key Example</b><br />' . "\r\n";