예제 #1
0
echo '<b>On Install</b><br />' . "\r\n";
echo 'The server details are evaluated in this script and if they meet the requirements the data<br />' . "\r\n";
echo 'is sent to my server and makes checks against the demo license server. If the request is<br />' . "\r\n";
echo 'approved. This file generates a temporary key to <a href="license.oninstall.dat" target="_blank" class="bodylink">license.oninstall.dat</a> license file<br />' . "\r\n";
echo '<b>########################################################################</b><br /><br />' . "\r\n";
echo '<span style="color: #F00"><b>Result of the License Request is : ' . $results['RESULT'] . '</b></span><br />';
switch ($results['RESULT']) {
    # this example will never return ok because my server is set to ADMIN
    # and returns temp keys valid for two days
    case 'OK':
        # if everything went ok for this example then PENDING is the result
        # it means that a temp key has been returned
    # if everything went ok for this example then PENDING is the result
    # it means that a temp key has been returned
    case 'PENDING':
        $key = $architect->validate($results['KEY']);
        echo '<span style="font-size: 10;color: #F00;">' . "\r\n";
        echo 'Key is valid untill : ' . $key['DATE']['HUMAN']['END'];
        echo '</span><br /><br />' . "\r\n";
        if ($architect->writeKey($results['KEY'])) {
            echo '<span style="color: #F00"><b>License Key Written to <a href="license.oninstall.dat" target="_blank" style="color: #F00;">license.oninstall.dat</a></b></span><br /><br />';
        } else {
        }
        echo '<b>Requested License Key</b><br />' . "\r\n";
        echo '<pre>' . $results['KEY'] . '</pre><br />' . "\r\n";
        echo '<b>Requested License Key Contents</b><br />' . "\r\n";
        echo '<pre>';
        print_r($key);
        echo '</pre><br />' . "\r\n";
        break;
        # means something went wrong transfering the data and no data was recieved by the server
예제 #2
0
# 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";
echo '<b>Generated License Key</b><br />' . "\r\n";
echo '<pre>' . $gen_key . '</pre><br />' . "\r\n";
if ($gen_key == 'DOMAIN_IP_FAIL') {
    echo '<span style="color: #F00;font-size: 10;">' . "\r\n";