if (isset($_POST['submit'])) { // register autoload include_once '../src/PHP5.2/Padl/PadlLibrary.php'; PadlLibrary::init(); // gets the data and transform to boolean $domain = $_POST['domain']; $useMcrypt = $_POST['useMcrypt'] == 'true' ? true : false; $useTime = $_POST['useTime'] == 'true' ? true : false; $useServer = $_POST['useServer'] == 'true' ? true : false; $allowLocal = $_POST['allowLocal'] == 'true' ? true : false; // calculates the offset (expire_in) $now = mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y')); $dateLimit = mktime(23, 59, 59, $_POST['dateLimitMonth'], $_POST['dateLimitDay'], $_POST['dateLimitYear']); $expireIn = $dateLimit - $now; // instatiate the class $padl = new PadlLicense($useMcrypt, $useTime, $useServer, $allowLocal); // copy the server vars (important for security, see note below) $server_array = $_SERVER; // 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 $padl->setServerVars($server_array); // generate a key with your server details $license = $padl->generate($domain, 0, $expireIn); header("Content-Type: application/save"); header("Content-Length:" . strlen($license)); header('Content-Disposition: attachment; filename="' . $_POST['filename'] . '"'); header("Content-Transfer-Encoding: binary");
<?php // register autoload include_once '../src/PHP5.2/Padl/PadlLibrary.php'; PadlLibrary::init(); // gets the data and transform to boolean $domain = $_POST['domain']; $useMcrypt = $_POST['useMcrypt'] == 'true' ? true : false; $useTime = $_POST['useTime'] == 'true' ? true : false; $useServer = $_POST['useServer'] == 'true' ? true : false; $allowLocal = $_POST['allowLocal'] == 'true' ? true : false; // calculates the time offset (expire_in) $now = mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y')); $dateLimit = mktime(23, 59, 59, $_POST['dateLimitMonth'], $_POST['dateLimitDay'], $_POST['dateLimitYear']); $expireIn = $dateLimit - $now; // instatiate the class $padl = new PadlLicense($useMcrypt, $useTime, $useServer, $allowLocal); // copy the server vars (important for security, see note below) $server_array = $_SERVER; // 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 $padl->setServerVars($server_array); // generate a key with your server details $license = $padl->generate($domain, 0, $expireIn); ?> <h2>Used code to generate</h2> <pre>
?> </dd> </dl> <?php // register autoload include_once '../src/PHP5.2/Padl/PadlLibrary.php'; PadlLibrary::init(); // gets the data and transform to boolean $useMcrypt = $_POST['useMcrypt'] == 'true' ? true : false; $useTime = $_POST['useTime'] == 'true' ? true : false; $useServer = $_POST['useServer'] == 'true' ? true : false; $allowLocal = $_POST['allowLocal'] == 'true' ? true : false; // instatiate the class $padl = new PadlLicense($useMcrypt, $useTime, $useServer, $allowLocal); // copy the server vars (important for security, see note below) $server_array = $_SERVER; // 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 $padl->setServerVars($server_array); ?> <h2>Instantiation</h2> <pre> // Register Autoload include_once('../src/PHP5.2/Padl/PadlLibrary.php'); PadlLibrary::init();