コード例 #1
0
ファイル: example.generate.php プロジェクト: vienis/padl
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";
echo 'Generate a key with your server details, should run and produce OK as the result value<br />' . "\r\n";
echo '<b>########################################################################</b><br /><br />' . "\r\n";
echo '<span style="color: #F00"><b>Generated License is : ' . $gen_data['RESULT'] . '</b><br />';
if ($gen_data['RESULT'] == 'OK') {
    echo '<span style="font-size: 10;">' . "\r\n";
    echo 'Key is valid untill : ' . $gen_data['DATE']['HUMAN']['END'];
    echo '</span>' . "\r\n";
}
echo '</span><br /><br />' . "\r\n";