SHARE
TWEET

Untitled

a guest Aug 17th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function check_license($licensekey, $localkey = '')
  4. {
  5.  
  6.  
  7.     $results['status'] = 'Active';
  8.     return $results;
  9. }
  10.  
  11. $usersip = file_get_contents('/var/cpanel/mainip');
  12. $usersip = trim($usersip);
  13. $servername = shell_exec('hostname');
  14. $servername = trim($servername);
  15. $licenseinvalid = true;
  16.  
  17. if (file_exists('/usr/local/cpanel/whostmgr/cgi/cPShield-v2/license.conf')) {
  18.     $localfile = file_get_contents('/usr/local/cpanel/whostmgr/cgi/cPShield-v2/license.conf');
  19. }
  20.  
  21. if (empty($localfile)) {
  22.     $localfile = '';
  23. }
  24.  
  25. preg_match('/^license=(\\S+)\\n/', $localfile, $match);
  26.  
  27. if (!isset($match[1])) {
  28.     $match[1] = NULL;
  29. }
  30.  
  31. $license = $match[1];
  32. preg_match('/\\nlocalkey=(\\S+)\\n/', $localfile, $match);
  33.  
  34. if (!isset($match[1])) {
  35.     $match[1] = NULL;
  36. }
  37.  
  38. $key = $match[1];
  39. $results = check_license($license, $key);
  40.  
  41. if ($results['status'] == 'Active') {
  42.     $licenseinvalid = false;
  43. }
  44.  
  45. if ($licenseinvalid && isset($_POST['license'])) {
  46.     $license = $_POST['license'];
  47.     $results = check_license($license);
  48.  
  49.     if ($results['status'] == 'Active') {
  50.         $licenseinvalid = false;
  51.         $file = fopen('/usr/local/cpanel/whostmgr/cgi/cPShield-v2/license.conf', 'w');
  52.         fwrite($file, 'license=' . $license . "\n");
  53.         fwrite($file, 'localkey=' . $results['localkey']);
  54.         fclose($file);
  55.     }
  56. }
  57.  
  58. echo "\r\n\r\n";
  59.  
  60. if ($licenseinvalid) {
  61.     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 : ';
  62.     echo $results['status'];
  63.     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>&nbsp;&nbsp;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" . '    ';
  64.     exit();
  65. }
  66.  
  67. echo "\r\n";
  68.  
  69. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top