Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function check_license($licensekey, $localkey = '')
- {
- $results['status'] = 'Active';
- return $results;
- }
- $usersip = file_get_contents('/var/cpanel/mainip');
- $usersip = trim($usersip);
- $servername = shell_exec('hostname');
- $servername = trim($servername);
- $licenseinvalid = true;
- if (file_exists('/usr/local/cpanel/whostmgr/cgi/cPShield-v2/license.conf')) {
- $localfile = file_get_contents('/usr/local/cpanel/whostmgr/cgi/cPShield-v2/license.conf');
- }
- if (empty($localfile)) {
- $localfile = '';
- }
- preg_match('/^license=(\\S+)\\n/', $localfile, $match);
- if (!isset($match[1])) {
- $match[1] = NULL;
- }
- $license = $match[1];
- preg_match('/\\nlocalkey=(\\S+)\\n/', $localfile, $match);
- if (!isset($match[1])) {
- $match[1] = NULL;
- }
- $key = $match[1];
- $results = check_license($license, $key);
- if ($results['status'] == 'Active') {
- $licenseinvalid = false;
- }
- if ($licenseinvalid && isset($_POST['license'])) {
- $license = $_POST['license'];
- $results = check_license($license);
- if ($results['status'] == 'Active') {
- $licenseinvalid = false;
- $file = fopen('/usr/local/cpanel/whostmgr/cgi/cPShield-v2/license.conf', 'w');
- fwrite($file, 'license=' . $license . "\n");
- fwrite($file, 'localkey=' . $results['localkey']);
- fclose($file);
- }
- }
- echo "\r\n\r\n";
- if ($licenseinvalid) {
- echo ' <!doctype html>' . "\r\n" . ' <html lang="en">' . "\r\n" . ' <head>' . "\r\n" . ' <meta charset="UTF-8">' . "\r\n" . ' <meta name="viewport"' . "\r\n" . ' content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">' . "\r\n" . ' <meta http-equiv="X-UA-Compatible" content="ie=edge">' . "\r\n" . ' <title>Invalid license</title>' . "\r\n" . ' <link rel="stylesheet" href="css/bootstrap.min.css">' . "\r\n" . ' <style>' . "\r\n\r\n\r\n" . ' body {' . "\r\n" . ' background: #f3f5f6 !important;' . "\r\n" . ' }' . "\r\n" . ' .license_ctx{' . "\r\n" . ' width: 100%;' . "\r\n" . ' max-width: 350px;' . "\r\n" . ' margin: auto;' . "\r\n\r\n" . ' }' . "\r\n" . ' .license-form{' . "\r\n" . ' padding-top: 10%;' . "\r\n" . ' }' . "\r\n" . ' .license_bg{' . "\r\n" . ' background: rgba(255,255,255,0.8);' . "\r\n" . ' float: left;' . "\r\n" . ' padding: 20px 10px;' . "\r\n" . ' border-radius: 5px;' . "\r\n" . ' }' . "\r\n" . ' .license_logo{' . "\r\n" . ' text-align: center;' . "\r\n" . ' width: 100%;' . "\r\n" . ' float: left;' . "\r\n" . ' margin-bottom: 10px;' . "\r\n" . ' }' . "\r\n" . ' </style>' . "\r\n" . ' </head>' . "\r\n" . ' <body>' . "\r\n\r\n\r\n" . ' <!--<div class="col-xs-7" style="margin-left:160px;height:220px; background-image:url(\'http://rep0.admin-ahead.com/sources/aast_cpprotect_backup/logo/logo.png\'); background-repeat:no-repeat;">' . "\r\n\r\n" . ' </div>-->' . "\r\n\r\n\r\n" . ' <div class="container license-form">' . "\r\n" . ' <div class="row">' . "\r\n" . ' <div class="license_ctx">' . "\r\n" . ' <div class="license_bg">' . "\r\n" . ' <div class="license_logo">' . "\r\n" . ' <img src="img/logo-plain.png" class="text-center" alt="">' . "\r\n" . ' </div>' . "\r\n" . ' <div class="col-xs-12 text text-danger" style="margin-bottom: 10px">' . "\r\n" . ' Your license is Invalid/Expired! Status : ';
- echo $results['status'];
- echo ' </div>' . "\r\n" . ' <div class="col-xs-12">' . "\r\n" . ' <form method="post" action="">' . "\r\n" . ' <div class="input-group">' . "\r\n" . ' <input type="text" class="form-control" name="license" placeholder="Enter your license key">' . "\r\n" . ' <span class="input-group-btn"><button type="submit" class="btn btn-success"><i' . "\r\n" . ' class="glyphicon glyphicon-ok"></i> Submit</button></span>' . "\r\n" . ' </div>' . "\r\n" . ' </form>' . "\r\n" . ' <a style="margin-top: 17px;float: left;width: 100%;text-align: center;" target="_blank" href=\'https://admin-ahead.com/portal/submitticket.php?step=2&deptid=1\'>Contact Us</a>' . "\r\n" . ' </div>' . "\r\n" . ' </div>' . "\r\n" . ' </div>' . "\r\n" . ' </div>' . "\r\n\r\n" . ' </body>' . "\r\n" . ' </html>' . "\r\n" . ' ';
- exit();
- }
- echo "\r\n";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement