Advertisement
plas71k

IonCube file - decoded

Dec 14th, 2012
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.79 KB | None | 0 0
  1. <?php
  2.  
  3. function chk($scr, $clientID, $serverAddr, $licenseStatus, $code)
  4. {
  5.     $generated = md5($scr . $clientID . $serverAddr . "valid" . $code);
  6.     $generated = sha1($generated);
  7.     return $generated;
  8. }
  9.  
  10. function fetchIt($url)
  11. {
  12.     $curl_handle = curl_init();
  13.     curl_setopt($curl_handle, CURLOPT_URL, $url);
  14.     curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
  15.     curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
  16.     $buffer = curl_exec($curl_handle);
  17.     curl_close($curl_handle);
  18.     return $buffer;
  19. }
  20.  
  21. function print_error($licenseID, $gotCode, $errorCode)
  22. {
  23.     if (empty($errorCode)) {
  24.         $errorCode = "<div style=\"color: red; font-size: 40px; position: absolute; top: 100px; left:200px; z-index:1999;\">ALERT: YOU DONT HAVE A VALID LICENCE<br /><br /><h4>visit <a href=\"http://www.scriptgeni.com\">ScriptGeni</a> to purchase a licence</h4></div>";
  25.     }
  26.     if ($licenseID != $gotCode) {
  27.         echo unhtmlentities($errorCode);
  28.         exit();
  29.     }
  30. }
  31.  
  32. function exx2($start, $end, $content)
  33. {
  34.     if ($content && $start && $end) {
  35.         $r = explode($start, $content);
  36.         if (isset($r[1])) {
  37.             $r = explode($end, $r[1]);
  38.             return $r[0];
  39.         }
  40.         return "";
  41.     }
  42. }
  43.  
  44. function curPageURLx()
  45. {
  46.     $pageURL = "http";
  47.     if ($_SERVER['HTTPS'] == "on") {
  48.         $pageURL .= "s";
  49.     }
  50.     $pageURL .= "://";
  51.     if ($_SERVER['SERVER_PORT'] != "80") {
  52.         $pageURL .= $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
  53.     } else {
  54.         $pageURL .= $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
  55.     }
  56.     return $pageURL;
  57. }
  58.  
  59. function exx($start, $end, $content)
  60. {
  61.     if ($content && $start && $end) {
  62.         $r = explode($start, $content);
  63.         if (isset($r[1])) {
  64.             $r = explode($end, $r[1]);
  65.             return $r[0];
  66.         }
  67.         return "";
  68.     }
  69. }
  70.  
  71. function disguise_curl($url)
  72. {
  73.     $curl      = curl_init();
  74.     $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
  75.     $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
  76.     $header[] = "Cache-Control: max-age=0";
  77.     $header[] = "Connection: keep-alive";
  78.     $header[] = "Keep-Alive: 300";
  79.     $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
  80.     $header[] = "Accept-Language: en-us,en;q=0.5";
  81.     $header[] = "Pragma: ";
  82.     curl_setopt($curl, CURLOPT_URL, $url);
  83.     curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 compatible RSS Fetcher");
  84.     curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
  85.     curl_setopt($curl, CURLOPT_REFERER, "-");
  86.     curl_setopt($curl, CURLOPT_ENCODING, "gzip,deflate");
  87.     curl_setopt($curl, CURLOPT_AUTOREFERER, true);
  88.     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  89.     curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 120);
  90.     curl_setopt($curl, CURLOPT_TIMEOUT, 120);
  91.     curl_setopt($curl, CURLOPT_MAXREDIRS, 5);
  92.     $html = curl_exec($curl);
  93.     curl_close($curl);
  94.     return $html;
  95. }
  96.  
  97. function unhtmlentities($string)
  98. {
  99.     $string    = preg_replace("~&#x([0-9a-f]+);~ei", "chr(hexdec(\"\\1\"))", $string);
  100.     $string    = preg_replace("~&#([0-9]+);~e", "chr(\"\\1\")", $string);
  101.     $trans_tbl = get_html_translation_table(HTML_ENTITIES);
  102.     $trans_tbl = array_flip($trans_tbl);
  103.     return strtr($string, $trans_tbl);
  104. }
  105.  
  106. function Get($varId)
  107. {
  108.     $file_name = cache_folder . $varId;
  109.     if (file_exists($file_name)) {
  110.         $fileHandler    = fopen($file_name, "r");
  111.         $varValueResult = fread($fileHandler, filesize($file_name));
  112.         fclose($fileHandler);
  113.         return unserialize($varValueResult);
  114.     }
  115.     return FALSE;
  116. }
  117.  
  118. function Set($varId, $varValue)
  119. {
  120.     Delete($varId);
  121.     $fileHandler = fopen(cache_folder . $varId, "a");
  122.     if (fwrite($fileHandler, serialize($varValue))) {
  123.         return true;
  124.     }
  125.     fclose($fileHandler);
  126.     return false;
  127. }
  128.  
  129. function Delete($varId)
  130. {
  131.     $file_name = cache_folder . $varId;
  132.     if (file_exists($file_name)) {
  133.         @unlink($file_name);
  134.     }
  135. }
  136.  
  137. function get_feeds($sourceUrl, $sourceName, $max = false)
  138. {
  139.     global $query;
  140.     global $jobLocation;
  141.     global $lang;
  142.     global $related;
  143.     $has_curl  = function_exists("curl_init");
  144.     $has_iconv = function_exists("iconv");
  145.     $target    = $has_curl ? disguise_curl($sourceUrl) : file_get_contents($sourceUrl);
  146.     $target    = $has_iconv ? iconv("UTF-8", "UTF-8//TRANSLIT", $target) : $target;
  147.     $i         = 1;
  148.     $deneme    = explode("<item>", $target);
  149.     $count     = count($deneme) - 1;
  150.     if (0 < $count) {
  151.         $count = !empty($max) ? $max : $count;
  152.     }
  153.     $count = _maxlisting < $count ? 20 : $count;
  154.     if ($count == 0) {
  155.         if (!$related) {
  156.             include("layout/nothingfound.php");
  157.         }
  158.     } else {
  159.         while ($i <= $count) {
  160.             $aud                 = explode("<item>", $target);
  161.             $aud                 = explode("</item>", $aud[$i]);
  162.             $aud[0]              = str_replace(array(
  163.                 "<![CDATA[",
  164.                 "]]>"
  165.             ), array(
  166.                 "",
  167.                 ""
  168.             ), $aud[0]);
  169.             $title               = exx("<title>", "</title>", $aud[0]);
  170.             $link                = exx("<link>", "</link>", $aud[0]);
  171.             $description         = exx("<description>", "</description>", $aud[0]);
  172.             $date                = exx("<pubDate>", "</pubDate>", $aud[0]);
  173.             $info['title']       = $title;
  174.             $info['link']        = $link;
  175.             $info['description'] = $description;
  176.             $info['date']        = $date;
  177.             $info['source_name'] = $sourceName;
  178.             $info['query']       = $query;
  179.             $info['location']    = $jobLocation;
  180.             if (set(md5($link), $info)) {
  181.                 if (!$related) {
  182.                     include("layout/search-results.php");
  183.                 } else {
  184.                     include("layout/related-results.php");
  185.                 }
  186.             }
  187.             ++$i;
  188.         }
  189.     }
  190. }
  191.  
  192. function parse($countrySelect, $query, $jobLocation, $max)
  193. {
  194.     $directory = "includes/sources/" . $countrySelect . "/";
  195.     $sources   = glob($directory . "*");
  196.     foreach ($sources as $source) {
  197.         if (substr($source, 0 - 4) == ".php") {
  198.             require($source);
  199.             get_feeds($sourceUrl, $sourceName, $max, $related);
  200.         }
  201.     }
  202. }
  203.  
  204. $v = "2.0.0";
  205. unset($scriptID);
  206. $scr        = "jobgeni";
  207. $serverAddr = strtolower(getenv("SERVER_NAME"));
  208. $first      = substr($serverAddr, 0, 4);
  209. if ($first == "www.") {
  210.     $serverAddr = str_replace($first, "", $serverAddr);
  211. }
  212. if (file_exists("license.php")) {
  213.     require_once("license.php");
  214. } else {
  215.     echo "no license file found... Please upload license.php file to your ftp";
  216.     exit();
  217. }
  218. if (empty($licenseID) || empty($clientID) || empty($scr)) {
  219.     echo "please make sure you have uploaded the correct license file...";
  220.     exit();
  221. }
  222. $code       = "mQGiBEm6XWkRBADgkaoaGataoddhdxAY18/GgR5GvOIeWMTmxZueXL3SZmlNnDmLYm8VU8AU+G3mTsuDNuqJNinN5c7oqmX/S/MSigHe8bS24yJuXiv5EPEj0IejAbDJY08gWvp9bXNT4dxNxK1MEWgUZWWBfKDGOK7ucTIFBEm6XWkRBADgkaoaGataoddhdxATmxZueXL3SZTZc6R+mvO3Dq0APgZkSSm2PthBw/9r+0JzmXhwinDQSs68JK8lttIz5JIBx6yXdLpvzqX0bfu0dQRyA3o6DGwed4Xq5FYP4EeCu94EeCu91qEhMr7pSaAkl+WL/PY18/GgR5GvOIeWMeDxSwsxhU9wCgpuWN4WYGt815F1TChakjcSJ7ZMkEAJZmHonmdsnN0nnL1qn7hEubcLP6zDxRmuRqmU5mJ2NmlNnJANc3++WL/PeDxSwsxhU9wCgpuWN4WYGt815TZc6R+mvO3Dq0APgZkSSm2PthBw/9r+0JzmXhwinDQSs68JK8lttIz5JIBx6yXdLpvzqX0bfu0dQRyA3o6DGwed4Xq5FYP4EeeMn9Ssqt0kIaA1qEhMr7pSaAklCu94EeCu91qEhMr7pSaAkl+WL/PY18/GgR5GvOIeWMeDxSwsxhU9wCgpuWN4WYGt815F1TChakjcSJ7ZMkEAJZmHonmdsnN0nnL1qn7hEubcLP6zDxRmuRqmU5mJ2NF1TChakjcSJ7ZMkEAJZmHonmdsnN0nnL1qn7hEubcLP6zDxRmuRqmU5mJ2NmlNnDmLYm8VU8AU+G3mTsuDNuqJNinN5c7oqmX/S/MSigHe8bS24yJuXiv5EPEj0IejAbDJY08gWvp9bXNT4dxNxK1MEWgUZWWBfKDGOK7ucTIFJANc3+eMn9Ssqt0kIaA";
  223. $ref        = $_SERVER['HTTP_REFERER'];
  224. $ipAdr      = $_SERVER['REMOTE_ADDR'];
  225. $XmlUrl     = "http://scriptgeni.com/check.php?v=" . $v . "&cID=" . urlencode($clientID) . "&sID=" . urlencode($scr) . "&domain=" . urlencode($serverAddr) . "&page=" . urlencode(curpageurlx()) . "&ref=" . urlencode($ref) . "&ip=" . $ipAdr;
  226. $checkLocal = md5($code . $serverAddr);
  227. if ($local == $checkLocal) {
  228.     $gotCode = chk($scr, $clientID, $serverAddr, "valid", $code);
  229.     print_error($licenseID, $gotCode, $errorCode);
  230. } else {
  231.     $ResponseXml = fetchit($XmlUrl);
  232.     if (!eregi("<license>", $ResponseXml)) {
  233.         $gotCode = chk($scr, $clientID, $serverAddr, "valid", $code);
  234.         print_error($licenseID, $gotCode, $errorCode);
  235.     } else {
  236.         $gotCode   = exx2("<licenseID>", "</licenseID>", $ResponseXml);
  237.         $errorCode = exx2("<error>", "</error>", $ResponseXml);
  238.         print_error($licenseID, $gotCode, $errorCode);
  239.     }
  240. }
  241. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement