예제 #1
0
echo '<b>########################################################################</b><br />' . "\r\n";
echo '<b>Set License Key Validation Example</b><br />' . "\r\n";
echo 'The <a href="license.supplied.dat" target="_blank" class="bodylink">license.supplied.dat</a> file is evaluated. If it is unwriteable the license returns with an error. It has also<br />' . "\r\n";
echo 'been validated for my server so when run on your box it will be return as illegal<br />' . "\r\n";
echo '<span style="font-size: 10;">' . "\r\n";
echo 'You should also note that even though the key is contains date restrictions the date binding<br />' . "\r\n";
echo 'was turned off when the class was inited.<br />' . "\r\n";
echo '</span>' . "\r\n";
echo '<b>########################################################################</b><br /><br />' . "\r\n";
echo '<span style="color: #F00"><b>Supplied License is : ' . $set_data['RESULT'] . '</b><br />';
if ($set_data['RESULT'] == 'OK') {
    echo '<span style="font-size: 10;">' . "\r\n";
    echo 'Key is valid untill : ' . $set_data['DATE']['HUMAN']['END'];
    echo '</span>' . "\r\n";
}
echo '</span><br /><br />' . "\r\n";
echo '<b>Supplied License Key</b><br />' . "\r\n";
echo '<pre>' . file_get_contents($application->_LICENSE_PATH) . '</pre><br />' . "\r\n";
echo '<b>License Key Contents</b><br />' . "\r\n";
echo '<pre>';
# validate the key that is supplied with this demo
print_r($set_data);
echo '</pre><br />' . "\r\n";
# make the application secure by running this function
# it also prevents any future reincarnations of the class calling any of the
# key generation and validation functions, it also deletes any class variables
# that may be set.
$application->make_secure();
# delete the $application object
unset($application);
echo '</body>' . "\r\n";
예제 #2
0
# initialise the class
$application = new license_application('license.generated.dat', false, true, true, true);
# set the server vars
$application->set_server_vars($server_array);
# validate the license key
$results = $application->validate();
# 5) -----------------------------------------------------------------------
# once the validation has been carried out there should be no need to run
# any other scripts. thus by running make_secure() you are wiping all the
# values from the class and defining a var that terminates the script if
# any important functions are called or a new instance of the class is
# redeclared or inited.
# by setting the param to true you can report any violations of this to your
# licensing server. Note the violations detected are only function accesses
# or redeclarations of the classes, not
$application->make_secure(true);
# inclusion of lang file for outputing errors and other text.
# you should look inside the lang file as it contains some security tests you
# can run to see how make_secure function works, this must always be below
# the make_secure function call, otherwise there are major security
# implications in the strength of your key
include_once 'demo.security.lang.php';
# 6) -----------------------------------------------------------------------
# switch through the results of the validation. This is the main one. If you
# don't check the validation results, what is the point of using this class!
switch ($results['RESULT']) {
    case 'OK':
        echo $LANG['LICENSE_OK'];
        break;
    default:
        die($LANG['LICENSE_FAILED']);