Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * @ https://EasyToYou.eu - IonCube v10 Decoder Online
- * @ PHP 5.5
- * @ Decoder version: 1.0.4
- * @ Release: 02/06/2020
- *
- * @ ZendGuard Decoder PHP 5.5
- */
- class ClassLicense
- {
- private $KEY = "8g-hg0fh-fjc0-gvh-9dg283fq-r9nsda[foc";
- private $DEBUG = 0;
- private $config = NULL;
- private $db = NULL;
- private $module_key = NULL;
- private $module_key2 = NULL;
- private $url = NULL;
- private $checked_domain = NULL;
- private $checked_base_domain = NULL;
- public function __construct($db, $config, $url, $module_key)
- {
- $this->config = $config;
- $this->db = $db;
- $this->url = $url;
- $this->module_key = $module_key;
- $this->module_key2 = str_replace("2", "", $module_key);
- }
- public function uploadURL($url)
- {
- $url .= "?license=" . implode(",", $this->getHashs());
- $page = "";
- if (extension_loaded("curl")) {
- $c = curl_init($url);
- curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
- $page = curl_exec($c);
- curl_close($c);
- } else {
- $page = file_get_contents($url);
- }
- return $page;
- }
- public function setDebug($value)
- {
- $this->DEBUG = $value;
- }
- public function saveLicense($code)
- {
- if (!$this->checkLicenseCode($code)) {
- if ($this->DEBUG) {
- exit("ERROR code");
- }
- return false;
- }
- $this->updateOneSetting("spk_license_" . $this->module_key, $code, "spk");
- return true;
- }
- private function getCheckedDomains()
- {
- if (!$this->checked_domain) {
- $this->checked_domain = $this->getCheckedDomain();
- }
- if (!$this->checked_base_domain) {
- $this->checked_base_domain = $this->getBaseDomain($this->checked_domain);
- }
- return array($this->checked_domain, $this->checked_base_domain);
- }
- private function getHashs()
- {
- list($checked_domain, $checked_base_domain) = $this->getCheckedDomains();
- $hash = "";
- $hash2 = "";
- if ($checked_domain && $checked_base_domain) {
- $hash = md5($this->module_key2 . "|" . $checked_domain . "|" . $this->KEY);
- $hash2 = md5($this->module_key2 . "|" . $checked_base_domain . "|" . $this->KEY);
- }
- return array($hash, $hash2);
- }
- public function checkLicenseCode($code)
- {
- $code = trim($code);
- list($hash, $hash2) = $this->getHashs();
- if (strstr($this->checked_base_domain, "localhost")) {
- return true;
- }
- if (!$this->checked_domain) {
- if ($this->DEBUG) {
- exit("ERROR domain");
- }
- return false;
- }
- return $this->checkLicenseStatus($hash, $hash2);
- }
- private function checkLicenseStatus($hash, $hash2)
- {
- if ($this->config->get($this->module_key . "2_lista") && ($this->config->get($this->module_key . "2_lista") == md5($hash . $this->KEY) || $this->config->get($this->module_key . "2_lista") == md5($hash2 . $this->KEY))) {
- return 1;
- }
- $url = "http://softpodkluch.ru/API/RP2/DATA.php?license=" . $hash . "," . $hash2 . "&checkonly=1";
- if (extension_loaded("curl")) {
- $c = curl_init($url);
- curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
- $page = curl_exec($c);
- curl_close($c);
- if (!$page) {
- $page = file_get_contents($url);
- }
- } else {
- $page = file_get_contents($url);
- }
- if ($page == "ERROR-1") {
- return -1;
- }
- if ($page == "ERROR-2") {
- return -2;
- }
- if ($page == "ERROR-3") {
- return -3;
- }
- if ($page == "ERROR-4") {
- return -4;
- }
- if ($page != md5($hash . $this->KEY) && $page != md5($hash2 . $this->KEY)) {
- return -1;
- }
- $this->updateOneSetting($this->module_key . "2_lista", $page);
- return true;
- }
- public function getVersion()
- {
- $VERSION = VERSION;
- $VERSION = str_replace(".", "", $VERSION);
- if (strlen($VERSION) == 3) {
- $VERSION .= "0";
- } else {
- if (4 < strlen($VERSION)) {
- $VERSION = substr($VERSION, 0, 4);
- }
- }
- return $VERSION;
- }
- public function checkLicense()
- {
- if (!$this->config->get("spk_license_" . $this->module_key)) {
- if ($this->DEBUG) {
- exit("license don't created");
- }
- return false;
- }
- list($hash, $hash2) = $this->getHashs();
- if (strstr($this->checked_base_domain, "localhost")) {
- return true;
- }
- if (!$this->checked_domain) {
- return false;
- }
- if ($this->config->get("spk_license_" . $this->module_key) != $hash && $this->config->get("spk_license_" . $this->module_key) != $hash2) {
- return false;
- }
- return $this->checkLicenseStatus($hash, $hash2);
- }
- private function getBaseDomain($domain)
- {
- if (!strstr($domain, ".")) {
- return $domain;
- }
- $ar = explode(".", $domain);
- $domain = $ar[count($ar) - 2] . "." . $ar[count($ar) - 1];
- return $domain;
- }
- private function getCheckedDomain()
- {
- $rand = md5(rand());
- $this->updateOneSetting("spk_license_rand", $rand);
- $domain = "";
- if (defined("HTTP_CATALOG")) {
- $domain = HTTP_CATALOG;
- } else {
- if (defined("HTTPS_CATALOG")) {
- $domain = HTTPS_CATALOG;
- } else {
- if (defined("HTTP_SERVER")) {
- $domain = HTTP_SERVER;
- } else {
- if (defined("HTTPS_SERVER")) {
- $domain = HTTPS_SERVER;
- } else {
- if (isset($_SERVER["HTTP_HOST"])) {
- $domain = $_SERVER["HTTP_HOST"];
- }
- }
- }
- }
- }
- $domain = preg_replace("/^https\\:\\/\\//", "", $domain);
- $domain = preg_replace("/^http\\:\\/\\//", "", $domain);
- $domain = preg_replace("/^www\\./", "", $domain);
- $domain = preg_replace("/\\/\$/", "", $domain);
- return $domain;
- }
- public function updateOneSetting($key, $value, $group = "")
- {
- $groupField = "group";
- if (2010 <= $this->getVersion()) {
- $groupField = "code";
- }
- if (!$group) {
- $group = $this->module_key . "2";
- }
- $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE \r\n\t\t\t\t`" . $groupField . "` = '" . $this->db->escape($group) . "' AND \r\n\t\t\t\t`key` = '" . $this->db->escape($key) . "'");
- if (0 < count($query->rows)) {
- $this->db->query("UPDATE " . DB_PREFIX . "setting \r\n\t\t\tSET \r\n\t\t\t\t`value` = '" . $this->db->escape($value) . "'\r\n\t\t\tWHERE \r\n\t\t\t\t`" . $groupField . "` = '" . $this->db->escape($group) . "' AND \r\n\t\t\t\t`key` = '" . $this->db->escape($key) . "'\r\n\t\t\t");
- } else {
- $this->db->query("INSERT INTO " . DB_PREFIX . "setting \r\n\t\t\tSET \r\n\t\t\t\t`value` = '" . $this->db->escape($value) . "',\r\n\t\t\t\t`" . $groupField . "` = '" . $this->db->escape($group) . "',\r\n\t\t\t\t`key` = '" . $this->db->escape($key) . "'\r\n\t\t\t");
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement