public function installLicense($path, $redirect = true, $includeExpired = true) { $application = new license_application($path, false, true, false, true, true); $results = $application->validate(false, false, "", "", "80", true); //if the result is ok then it is saved into DB $res = $results['RESULT']; if ($res == 'EMPTY') { return false; } if (!$includeExpired) { if ($res == 'EXPIRED') { return false; } } if ($res != 'OK' && $res != 'EXPIRED' && $res != 'TMINUS') { G::SendTemporalMessage('ID_ISNT_LICENSE', 'tmp-info', 'labels'); return false; } else { G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $oServerConf->setProperty('ACTIVE_LICENSE', array(SYS_SYS => $path)); $this->saveDataLicense($results, $path, $redirect); if ($redirect) { G::Header('location: ../enterprise/addonsStore'); } else { return true; } } }
echo '<body>' . "\r\n"; echo '<span class="header">' . "\r\n"; echo '<b>########################################################################</b><br />' . "\r\n"; echo '<b>Dial Home Demostration</b><br />' . "\r\n"; echo 'This file is a demonstration file that illustrates how to perform a dial home check<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'; # initialise the class with mcrypt off to maximise compatability with servers $application = new license_application('license.supplied.dat', false, true, false, 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 $application->set_server_vars($server_array); # the key to be validated # the key below contains the id used in the home server db. it was created like so # $application->generate(array('_LICENSE_ID'=>1)); # validate the data from the key $set_data = $application->validate(false, true, 'www.buggedcom.co.uk', 'http://www.buggedcom.co.uk/distributionlicense/files/server/demo.receive.license.php'); echo '<b>########################################################################</b><br />' . "\r\n"; echo '<b>Set License Key Validation Example</b><br />' . "\r\n"; echo 'The set key is validated to an id in my db on my server. It dials home to...<br />' . "\r\n";
echo '<b>Generation & Validation Demonstrations</b><br />' . "\r\n"; echo 'This file is a demonstration file that illustrates ways to generate and check a license key<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'; # 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) $application = new license_application('license.supplied.dat', 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 $application->set_server_vars($server_array); # the set key is the key validated for my server, when run on your box it will be illegal $set_data = $application->validate(); 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";
@fclose($h); } else { header('Location: ' . $_SERVER['PHP_SELF']); exit; } } # copy the server vars (important for security, see note below) $server_array = $_SERVER; # import the classes include_once '../shared/class.license.lib.php'; include_once '../app/class.license.app.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) $application = new license_application('license.dat', false, true, false, 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 $application->set_server_vars($server_array); # the set key is the key validated for my server, when run on your box it will be illegal $results = $application->validate(); # 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