Не работает чекер PR.

Sashak

Создатель
Регистрация
8 Дек 2008
Сообщения
25
Реакции
0
Здравствуйте.
Скачал скрипт проверки сайта и поставил скрипт типа bname.ru. Некоторые функции не работают, в первую очередь самое нужное проверка пр.
В двух файлах встречается воспоминание про ПР.
Первый файл func.php Все содержимое файла:
PHP:
<?
// Yandex ALL
function getYA($url)
{	
	$errYa = "Не удалось соединиться с сервером Яндекса, показатели тИЦ, Rang не получены";
	$file = @join("", @file('http://bar-navig.yandex.ru/u?ver=2&show=32&url=http://'.$url));
	if (!$file) {return array(0,0,"Нет",""," ",$errYa);}
else {
	preg_match("/value=\"(.\d*)\"/", $file, $cy);
	$cy = $cy[1]; if ($cy=="") $cy = 0;
	preg_match("/rang=\"(.\d*)\"/", $file, $rang);
	$rang = $rang[1]; if ($rang=="") $rang = 0;
	$is_topic = preg_match_all("/Тема: (.*)/", $file, $ya);
		if ($is_topic!="" && $is_topic!=0) {$nextcat = ""; if ($ya[1][2]!="") {$nextcat = ", ".$ya[1][2]; if ($ya[1][3]!="") {$nextcat = ", ".$ya[1][2].", ".$ya[1][3]; if ($ya[1][4]!="") {$nextcat = ", ".$ya[1][2].", ".$ya[1][3].", ".$ya[1][4];}}}
				$topic = "(".$ya[1][1].$nextcat.")";} else {$topic = " ";}
	$yacaUrl = preg_match("/url=\"(.*)\"/", $file, $yaca);
		if ($yacaUrl)
			{
			$yaca = "Да";
			$link1 = "<a rel='nofollow' target='_blank' href='http://search.yaca.yandex.ru/yca/cy/ch/".$url."'>";
			$link2 = "</a>";
			}
			 else
			{
			$yaca = "Нет";
			$link1 = "";
			$link2 = "";
			}
	preg_match("/url domain=\"(.*)\"/", $file, $stick);
		if (strcmp("www.",substr($stick[1],0,4))==0) {$stick[1] = substr($stick[1],4,strlen($stick[1])-4);}
		if (strcmp("www.",substr($url,0,4))==0) {$url = substr($url,4,strlen($url)-4);}
		if ($stick[1]!=$url && $stick[1]!="") {$stick = $stick[1];} else {$stick[1] = ""; $stick = $stick[1];}
	return array($cy,$rang,$yaca,$stick,$topic,$link1,$link2);
	}
}
// Webalta WTR и WR
function getWebalta($url)
{	
	$errWa = "Не удалось соединиться с сервером Webalta, показатели WR/WTR не получены";
	$sock1 = @fsockopen("www.webalta.ru",80,$errno,$errstr,5);
  	if (!$sock1) {return array(0,0,$errWa);} else {
	fclose($sock1);
	$file = @fopen("http://www.webalta.ru/reliance?url=".$url."", "r");
	if (!$file) {return array(0,0,$errWa);}
else {
	$size = 6;
	$buffer = split(' ',trim(fread($file, $size)));
	fclose ($file);
	$altaWTR = $buffer[0];
	$altaWR = $buffer[1];
	if ($altaWTR=="") $altaWTR = 0;
	if ($altaWR=="") $altaWR = 0;
	return array($altaWTR,$altaWR);
	}
	}
}
// Наличие в каталоге dmoz (odp)
function getDmoz($url)
{
	$url = str_replace("www.","",$url);
	$file = @join("", @file('http://search.dmoz.org/cgi-bin/search?search='.$url));
	if (!$file) {return array("Ошибка",$found,$link2,$category);}
else {
	$string = "match";
	$findStr = strpos($file, $string);
	if ($findStr)
		{
		$found = "Да";
		preg_match("/<li><b><a href=\"http:\/\/dmoz.org\/(.*)\">(.*)<\/a>/i",$file,$catinfo);
		$link1 = "<a rel='nofollow' target='_blank' href='http://search.dmoz.org/cgi-bin/search?search=".$url."'>";
		$link2 = "</a>"; 
		$category = str_replace(": "," > ",$catinfo[2]);
		$category = utf8_win($category);
		//$category = mb_convert_encoding($category, "CP1251","UTF-8");
		$category = "(".$category.")";
		}
		 else
		{
		$found = "Нет";
		$link1 = "";
		$link2 = "";
		$category = "";
		}
	return array($link1,$found,$link2,$category);
	}
}
// Наличие в каталоге Aport
function getAport($url)
{
	$url = str_replace("www.","",$url);
	$file = @join("", @file('http://sm.aport.ru/scripts/template.dll?That=std&from=bottom_form&r=URL%3Dwww.'.$url));
	if (!$file) {return array("Ошибка",$found,$link2,$category);}
else {
	$string = "<a class=light target=_blank href=http://catalog.aport.ru/rus/themes.aspx?id=";
	$stringUrl = "http://catalog.aport.ru/rus/themes.aspx?id=";
	$findStr = @strpos($file, $string);
	if ($findStr)
		{
		 $found = "Да";
		 preg_match("/http:\/\/catalog\.aport\.ru\/rus\/themes\.aspx\?id=(\d+)>(.*)<\/a>/i",$file,$catinfo);
		 $link1 = "<a rel='nofollow' target='_blank' href='".$stringUrl.$catinfo[1]."'>";
		 $link2 = "</a>"; 
		 $category = str_replace(" --> "," > ",$catinfo[2]);
		 $category = "(".$category.")";
		}
		 else 
		{
		$found = "Нет";
		$link1 = "";
		$link2 = "";
		$category = "";
		}
	return array($link1,$found,$link2,$category);
	}
}
// Массив с хостами google для того чтобы не блокировали
$googleArr = array("www.google.com",
"www.google.ru");
$uniq = mt_rand(0,1);
$googleHost = $googleArr[$uniq];
// Кол-во проиндексированных в google страниц (с www и без)
function getIndexGoogle($url)
{ global $googleHost;
$host = &$googleHost; 
$path = "/search?q=site:$url&hl=en&lr=&ie=UTF-8&filter=0&btnG=Search";
$buffer = true; 
$fp = @fsockopen("tcp://".$host, 80, $errno, $errstr, 10); 
if (!$fp) {return 0;}
 else { 
         $out  = "GET $path HTTP/1.0\r\n"; 
         $out .= "Host: $host\r\n"; 
         $out .= "Referer: $host$path\r\n";
         $out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"; 
         $out .= "Connection: Close\r\n"; 
         $out .= "\r\n"; 
         fwrite($fp, $out); 
         while (!feof($fp)) { 
             $buffer .= fgets($fp, 1024); 
         } 
         fclose($fp); 
     }
	$indexStand = preg_match("/Results <b>(.*){1}<\/b> - <b>(.*){1}<\/b> of about <b>(.*)<\/b> from <b>/i", $buffer, $indexG);
	if ($indexStand) {$indexed = $indexG[3];}
	else {$indexMini = preg_match("/Results <b>(.*){1}<\/b> - <b>(.*){1}<\/b> of <b>(.*)<\/b> from <b>/i", $buffer, $indexG);
	if ($indexMini) {$indexed = $indexG[3];} else {$indexed = 0;} }
	$indexed = str_replace(",","",$indexed);
	$indexed = str_replace(" ","",$indexed);
	$indexed = str_replace("&nbsp;","",$indexed);
	return (int)$indexed;
} 
// Кол-во проиндексированных в Яндекс страниц (с www и без)
function getIndexYa($url)
{
$host = "www.yandex.ru"; 
$path = "/yandsearch?serverurl=$url";
$buffer = true; 
$fp = @fsockopen("tcp://".$host, 80, $errno, $errstr, 10); 
if (!$fp) {return 0;}
 else { 
         $out  = "GET $path HTTP/1.1\r\n"; 
         $out .= "Host: $host\r\n"; 
         $out .= "Referer: $host$path\r\n";
         $out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"; 
         $out .= "Connection: Close\r\n"; 
         $out .= "\r\n"; 
         fwrite($fp, $out); 
         while (!feof($fp)) { 
             $buffer .= fgets($fp, 1024); 
         } 
         fclose($fp); 
     } 
	preg_match("/Результат поиска: страниц&nbsp;&mdash; <b>(.*)<\/b><br>/i", $buffer, $indexYa);
	$indexed = $indexYa[1];
	if ($indexed=="") $indexed = 'Check';
	$indexed = str_replace("&nbsp;","",$indexed);
	$indexed = str_replace(",","",$indexed);
	$indexed = str_replace(" ","",$indexed);
	return $indexed;
}
// Кол-во беклинков в Google
function getBackGoogle($url)
{ global $googleHost;
$host = &$googleHost; 
$path = "/search?hl=en&lr=&q=link%3A$url&btnG=Search";
$buffer = true; 
$fp = @fsockopen("tcp://".$host, 80, $errno, $errstr, 10); 
if (!$fp) {return 0;}
 else { 
         $out  = "GET $path HTTP/1.0\r\n"; 
         $out .= "Host: $host\r\n"; 
         $out .= "Referer: $host$path\r\n";
         $out .= "User-Agent: Opera/9.10 (Windows NT 5.1; U; ru)\r\n"; 
         $out .= "Connection: Close\r\n"; 
         $out .= "\r\n"; 
         fwrite($fp, $out); 
         while (!feof($fp)) { 
             $buffer .= fgets($fp, 1024); 
         } 
         fclose($fp); 
     } 
	$backStand = preg_match("/Results <b>(.*){1}<\/b> - <b>(.*){1}<\/b> of about <b>(.*)<\/b> linking to <b>$url<\/b>/i", $buffer, $linksG);
	if ($backStand) {$backlinks = $linksG[3];}
	else {$backMini = preg_match("/Results <b>(.*){1}<\/b> - <b>(.*){1}<\/b> of <b>(.*)<\/b> linking to <b>$url<\/b>/i", $buffer, $linksG);
	if ($backMini) {$backlinks = $linksG[3];} else {$backlinks = 0;} }
	$backlinks = str_replace(",","",$backlinks);
	$backlinks = str_replace(" ","",$backlinks);
	$backlinks = str_replace("&nbsp;","",$backlinks);
	return (int)$backlinks;
} 
// Кол-во беклинков со страниц и с сайтов в Яндекс
function getBackYa($url)
{
	$file = @join("", @file('http://www.yandex.ru/yandsearch?text='.$url));
	if (!$file) {return 0;}
else {
	preg_match("/Результат поиска: страниц&nbsp;&mdash; <b>(.*)<\/b>,/", $file, $backPages); // страницы
	preg_match("/сайтов&nbsp;&mdash; не менее <b>(.*)<\/b><br>/", $file, $backSites); // сайты
	if ($backPages[1] == "") $backPages[1] = 'Check';
	if ($backSites[1] == "") $backSites[1] = 'Check';
	$backPages = $backPages[1];
	$backSites = $backSites[1];
	$backPages = str_replace("&nbsp;","",$backPages);
	$backPages = str_replace(",","",$backPages);
	$backPages = str_replace(" ","",$backPages);
	$backSites = str_replace("&nbsp;","",$backSites);
	$backSites = str_replace(",","",$backSites);
	$backSites= str_replace(" ","",$backSites);
	return array($backPages,$backSites);
	}
}
// Кол-во беклинков в Rambler
function getBackRambler($url)
{ 
$host = "search.rambler.ru"; 
$path = "/srch?words=\"$url\"&news=2";
$buffer = true; 
$fp = @fsockopen("tcp://".$host, 80, $errno, $errstr, 10); 
if (!$fp) {return 0;}
 else { 
         $out  = "GET $path HTTP/1.1\r\n"; 
         $out .= "Host: $host\r\n"; 
         $out .= "Referer: $host$path\r\n";
         $out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"; 
         $out .= "Connection: Close\r\n"; 
         $out .= "\r\n"; 
         fwrite($fp, $out); 
         while (!feof($fp)) { 
             $buffer .= fgets($fp, 1024); 
         } 
         fclose($fp); 
     } 
    // <nobr>Вы искали: <b>&quot;bname.ru&quot;</b>, </nobr>найдено&nbsp;сайтов:&nbsp;<b>169</b>, документов:&nbsp;<b>33963</b
	preg_match("/документов:&nbsp;<b>(.*)<\/b>/", $buffer, $backPages); // страницы
	preg_match("/<\/nobr>найдено&nbsp;сайтов:&nbsp;<b>(.*)<\/b>, документов:&nbsp;<b>/", $buffer, $backSites); // сайты
	if ($backPages[1] == "") $backPages[1] = 0;
	if ($backSites[1] == "") $backSites[1] = 0;
	$backPages = $backPages[1];
	$backSites = $backSites[1];
	$backPages = str_replace("&nbsp;","",$backPages);
	$backPages = str_replace(",","",$backPages);
	$backPages = str_replace(" ","",$backPages);
	$backSites = str_replace("&nbsp;","",$backSites);
	$backSites = str_replace(",","",$backSites);
	$backSites= str_replace(" ","",$backSites);
	$backPages = str_replace("<b>","",$backPages);
	$backPages = str_replace("</b>","",$backPages);
	$backPages = str_replace("новых:","",$backPages);
	$backSites = str_replace("<b>","",$backSites);
	$backSites = str_replace("</b>","",$backSites);
	$backSites= str_replace("новых:","",$backSites);
	return array((int)$backPages,(int)$backSites);
} 
// Информация о сервере
function getHostInfo($host, $path) {
$fp = @fsockopen($host,80,&$errno,&$errstr,10);
@socket_set_blocking($fp, 1);
@fputs($fp,"GET $path HTTP/1.1\r\n");
@fputs($fp, "Host: $host\r\n\r\n");
for($x = 1;$x < 10;$x++) {
$headers = @fgets($fp, 4096);
$hostInfo[] = $headers;
}
@fclose($fp);
return $hostInfo;
}
// Определение склейки доменов по PR (Google)
function getStickGoogle($url)
{ global $googleHost;
$host = &$googleHost; 
$path = "/search?q=info:$url&hl=en&lr=&ie=UTF-8&filter=0&btnG=Search";
$buffer = true; 
$fp = @fsockopen("tcp://".$host, 80, $errno, $errstr, 10); 
if (!$fp) {return 0;}
 else { 
         $out  = "GET $path HTTP/1.0\r\n"; 
         $out .= "Host: $host\r\n"; 
         $out .= "Referer: $host\r\n"; 
         $out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon)\r\n"; 
         $out .= "Connection: Close\r\n"; 
         $out .= "\r\n"; 
         fwrite($fp, $out); 
         while (!feof($fp)) { 
             $buffer .= fgets($fp, 1024); 
         } 
         fclose($fp); 
     }
    $url = str_replace("www.","",$url);
	$url = str_replace("https://","",$url);
    $url = str_replace("/","",$url);
	$stickSrc = preg_match("/<br><span class=a>(.*)<\/span><\/font>/i", $buffer, $stickG);
if ($stickSrc)
		{
		$stickG[1] = str_replace("www.","",$stickG[1]);
		$stickG[1] = str_replace("https://","",$stickG[1]);
		$stickG[1] = preg_replace("/\/(.*)/","",$stickG[1]);
		if(stristr($url,$stickG[1]))
			{$stick = "";}
		 	else
			{$stickG[1] = preg_replace("/\/(.*)/","",$stickG[1]); $stick = $stickG[1];}
		} else {$stick = "no index";}
	return $stick;
} 
function getAlexaRanking($url)
{
$subscription_id = "09FVDRT8TEJ64C2A7Y02";
list($protocol, $uri) = split('//', $url);
$url = "http://aws.amazon.com/onca/xml?Service=AlexaWebInfoService&SubscriptionId=$subscription_id&Operation=UrlInfo&Response=Rank&Url=$uri";
$xml = file_get_contents($url);
if(eregi("<rank *>([^<]*)</rank *>",$xml,$r))
{$rank = $r[1];} else {$rank = 0;}
$rank = number_format($rank);
return $rank;
}
function alexaCheck($url)
{
$path ="http://www.alexa.com/data/details/main?q=&url=".$url;
if(!file_exists($path))
{
	$data = strtolower(strip_tags(implode("", file($path))));
	$data = substr($data, strpos($data, "traffic rank for ")+17, strlen($data));
	$data = str_replace(str_replace('www.', '', $url), '', $data);
	$data = str_replace(':&nbsp;', '', $data);
	$data = trim(substr($data, 0, strpos(trim($data), ' ')-1));
	if(eregi("[[:alpha:]]", $data)) 
		{$results['alexa'] = array('0', $path);} else {$results['alexa'] = array($data, $path);}
} else {$results['alexa'] = array('n/a', $path);}
$results['alexa']['0'] = str_replace(',', '', $results['alexa']['0']);
if($results['alexa']['0']=="") {$results['alexa']['0']="n/a";}	
return $results;
}
function alexaCheck2($url)
{
$res = "";
$host = "www.alexa.com"; 
$path = "/data/details/main?q=&url=$url";
$buffer = true; 
$fp = fsockopen("tcp://".$host, 80, $errno, $errstr, 10); 
if (!$fp) {$resna = "n/a"; return $resna;}
 else { 
         $out  = "GET $path HTTP/1.0\r\n"; 
         $out .= "Host: $host\r\n"; 
         $out .= "Referer: $host\r\n"; 
         $out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon)\r\n"; 
         $out .= "Connection: Close\r\n"; 
         $out .= "\r\n"; 
         fwrite($fp, $out); 
         while (!feof($fp)) { 
             $buffer .= fgets($fp, 1024); 
         } 
         fclose($fp); 
     }
$url_www = str_replace('www.', '', $url);
$alexaData = preg_match('/document.write\(String.fromCharCode\((.*)\)\)/i', $buffer, $data);
if($alexaData==1) 
{
$dataExp = explode(",",$data[1]);
$cntChr = count($dataExp);
for($i=0;$i<$cntChr;$i++)
	{
	for($p=0;$p<$cntChr;$p++)
		{
		$dataN[$i] = explode("+",$dataExp[$i]);
		}
	}
for($d=0;$d<$cntChr;$d++)
	{
	$dataT[$d] = (int)$dataN[$d][0]+(int)$dataN[$d][1];
	$res .= chr((int)$dataT[$d]);
	}
$res = trim(strip_tags($res));
$res = str_replace(",", "", $res);
	}
if((int)$res=="") {$res="n/a";}	
return $res;
}
function quantcast($url)
{
	$sock1 = @fsockopen("www.quantcast.com",80,$errno,$errstr,5);
  	if (!$sock1) {return 0;} else {
	fclose($sock1);
	$file = @fopen("http://www.quantcast.com/".$url, "r");
	if (!$file) {return 0;}
else {
	$size = 600;
	$buffer = fread($file, $size);
	fclose ($file);
	preg_match("/<title>(.*) \(rank (.*)\) (.*)<\/title>/i", $buffer, $ranking);
	if ($ranking[2] == "") {$ranking[2] = 0;}
else {
	 $rank = $ranking[2];
	 $rank = str_replace("&nbsp;","",$rank);
	 $rank = str_replace("rank","",$rank);
	 $rank = str_replace(",","",$rank);
	 $rank = str_replace(" ","",$rank);
	 }
	if($rank=="") {$rank="n/a";}
	return $rank;
	}
	}
}
// Google PR
define('GOOGLE_MAGIC', 0xE6359A60);
function nooverflow($a)
  {
  while ($a<-2147483648)
     $a+=2147483648+2147483648;
  while ($a>2147483647)
     $a-=2147483648+2147483648;
  return $a;
  }
function zeroFill ($x, $bits)
  {
  if ($bits==0) return $x;
  if ($bits==32) return 0;
  $y = ($x & 0x7FFFFFFF) >> $bits;
  if (0x80000000 & $x)
     {
     $y |= (1<<(31-$bits));
     }
  return $y;
}
function mix($a,$b,$c)
  {
  $a=(int)$a; $b=(int)$b; $c=(int)$c;
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,13));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<8);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,13));
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,12));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<16);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,5));
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,3));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<10);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,15));
  return array($a,$b,$c);
  }
function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC) {
if(is_null($length)) {
$length = sizeof($url);
}
$a = $b = 0x9E3779B9;
$c = $init;
$k = 0;
$len = $length;
while($len >= 12) {
$a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24));
$b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24));
$c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24));
$mix = mix($a,$b,$c);
$a = $mix[0]; $b = $mix[1]; $c = $mix[2];
$k += 12;
$len -= 12;
}
$c += $length;
switch($len) 
{
case 11: $c+=($url[$k+10]<<24);
case 10: $c+=($url[$k+9]<<16);
case 9 : $c+=($url[$k+8]<<8);
case 8 : $b+=($url[$k+7]<<24);
case 7 : $b+=($url[$k+6]<<16);
case 6 : $b+=($url[$k+5]<<8);
case 5 : $b+=($url[$k+4]);
case 4 : $a+=($url[$k+3]<<24);
case 3 : $a+=($url[$k+2]<<16);
case 2 : $a+=($url[$k+1]<<8);
case 1 : $a+=($url[$k+0]);
}
$mix = mix($a,$b,$c);
return $mix[2];
}
function strord($string) {
for($i=0;$i<strlen($string);$i++) {
$result[$i] = ord($string{$i});
}
return $result;
}
function get_pr($url) {
$result=array("",-1);
if (($url.""!="")&&($url.""!="http://")):
if (substr(strtolower($url),0,7)!="http://"):
$url="http://".$url;
endif;
$url="info:".$url;
$checksum=GoogleCH(strord($url));
$google_url=sprintf("http://www.google.com/search?client=navclient&ch=6%u&features=Rank&q=".$url,$checksum); // url to get from google
$handle = @fopen($google_url, "rb");
$contents = '';
if ($handle) {
while (!@feof($handle)) {
 $contents.= @fread($handle, 8192);
}
fclose($handle);
$p=explode(":",$contents);
if (isset($p[2])):
$result=trim($p[2]);
endif;
} else {$result = 0;}
endif;
return($result!="" && (strlen($result)>0 && (strlen($result)<3))?$result:"0");
}
// Получаем ip по домену
function getIP($url)
{
$ip = gethostbyname($url);
return $ip;
}
function message($msg)
{
$msg = preg_replace("/%(.*)<br \/>/i","",$msg);
$msg = preg_replace("/#(.*)<br \/>/i","",$msg);
$msg = str_replace("\n<br />\n","",$msg);
print $msg;
flush();
}
// IP-Lookup
function ipLookup($target)
{
$target = gethostbyname($target);
$server = "whois.arin.net";
if (!$sock = fsockopen($server,43,$num,$error,20)) {unset($sock); $msg .= "Таймаут соединения к серверу $server (порт 43)";} else {
    fputs($sock, "$target\n");
    while (!feof($sock))
      $buffer .= fgets($sock, 10240); 
    fclose($sock);
    }
   if (eregi("RIPE.NET", $buffer))
     $nextServer = "whois.ripe.net";
   else if (eregi("whois.apnic.net", $buffer))
     $nextServer = "whois.apnic.net";
   else if (eregi("nic.ad.jp", $buffer)) {
     $nextServer = "whois.nic.ad.jp";
     $extra = "/e";
     }
   else if (eregi("whois.registro.br", $buffer))
     $nextServer = "whois.registro.br";
   if($nextServer)
   {
     $buffer = "";
     if(!$sock = fsockopen($nextServer,43,$num,$error,10))
	 {
       unset($sock);
       $msg .= "Таймаут соединения к серверу $nextServer (порт 43)";
     } else {
       fputs($sock, "$target$extra\n");
       while (!feof($sock))
         $buffer .= fgets($sock, 10240);
       fclose($sock);
       }
    }
  $msg .= nl2br($buffer);
  $msg = message($msg);
return $msg;
}
function cleanInput($string)
{
	$string = str_replace("<script","",$string);
	$string = str_replace("<frame","",$string);
	$string = str_replace("<object","",$string);
	$string = str_replace("<iframe","",$string);	
	$string = str_replace("<applet","",$string);
	$string = str_replace("<meta","",$string);
	$string = str_replace("\|","",$string);
	$string = str_replace("\'","",$string);
	$string = str_replace("|","",$string);
	$string = str_replace("'","",$string);
	$string = stripslashes(strip_tags($string));
	if (strcmp("http://",substr($string,0,7))==0)
	{$string=substr($string,7,strlen($string)-7);}
	if (strcmp("https://",substr($string,0,8))==0)
	{$string=substr($string,8,strlen($string)-8);}
	$string = preg_replace("/\/(.*)/","",$string);
	return $string;
}
// ФУНКЦИИ ДЛЯ БАЗЫ ДАННЫХ И АДМИНКИ
function getSqlRow($query) {
	$result = mysql_query($query) or echoErr();
	$row = mysql_fetch_array($result);
	mysql_free_result($result);
	return $row;
}
function getSqlNumber($sqlQuery) {
	$query=@mysql_query($sqlQuery);
	$result=@mysql_num_rows($query);
	@mysql_free_result($query);
	return $result;
}
function getFullDate($date) {
	$date = date('l dS of F Y h:i:s A', $date);
	return $date;
}
function getMinDate($date) {
	$date = date('d.m.Y', $date);
	return $date;
}
function pages($start,$limit,$total,$filePath,$otherParams) {
$allPages = ceil($total/$limit);
$currentPage = floor($start/$limit) + 1;
$pagination = "";
if ($allPages>10) {
	$maxPages = ($allPages>9) ? 9 : $allPages;
if ($allPages>9) {
	if ($currentPage>=1&&$currentPage<=$allPages) {
		$pagination .= ($currentPage>4) ? " ... " : " ";
		$minPages = ($currentPage>4) ? $currentPage : 5;
		$maxPages = ($currentPage<$allPages-4) ? $currentPage : $allPages - 4;
		for($i=$minPages-4; $i<$maxPages+5; $i++) {
$pagination .= ($i == $currentPage) ? "".$i." " : "<a href=\"".$filePath."?start=".(($i-1)*$limit).$otherParams."\">".$i."</a> ";
				}
				$pagination .= ($currentPage<$allPages-4) ? " ... " : " ";
			} else {
				$pagination .= " ... ";
			}
		}
	} else {
		for($i=1; $i<$allPages+1; $i++) {
$pagination .= ($i==$currentPage) ? "".$i." " : "<a href=\"".$filePath."?start=".(($i-1)*$limit).$otherParams."\">".$i."</a> ";
		}
	}
if ($currentPage>1) $pagination = "<a href=\"".$filePath."?start=0".$otherParams."\">&lt;&lt;</a>&nbsp;<a href=\"".$filePath."?start=".(($currentPage-2)*$limit).$otherParams."\">&lt;</a> ".$pagination;
if ($currentPage<$allPages) $pagination .= " <a href=\"".$filePath."?start=".($currentPage*$limit).$otherParams."\">&gt;</a>&nbsp;<a href=\"".$filePath."?start=".(($allPages-1)*$limit).$otherParams."\">&gt;&gt;</a>";
print $pagination;
}
function getParameter($varName,$varAlt)
{
$lVarName=$_REQUEST[$varName];
if (!Empty($lVarName)) {	
	if (is_array($lVarName)) {
		$lReturnArray = array();
		foreach ($lVarName as $key => $value) {
			$value=cleanInput($value);
			$key=cleanInput($key);
			$lReturnArray[$key]=$value;
		}
		return $lReturnArray;
	}
	else 
		return cleanInput($lVarName);
	}
	else 
		return $varAlt;
}
function ping($target){
message("<h1>Результаты Ping:</h1>");
if (! $msg .= trim(nl2br(`ping -c5 '$target'`)))
  $msg .= "Ping: произошла ошибка. Возможно, хост не доступен.";
$msg .= "<br /><br />";
$ping = message($msg);
return $ping;
}
function trace($target){
message("<h1>Результаты Traceroute:</h1>");
if (! $msg .= trim(nl2br(`/usr/sbin/traceroute '$target'`)))
  {$msg .= "Traceroute: произошла ошибка. Возможно, хост не доступен.";}
$msg .= "<br />";
$trace = message($msg);
return $trace;
}
function dig($target){
global $ntarget;
message("<h1>Результаты DNS запроса:</h1>");
if( (!eregi("[a-zA-Z]", $target) && (!eregi("[a-zA-Z]", $ntarget))))
  $msg .= "Не возможно сделать запрос без хоста.";
else{
  if(!eregi("[a-zA-Z]", $target)) $target = $ntarget;
  if (! $msg .= trim(nl2br(`dig any '$target'`)))
    $msg .= "Команда <i>dig</i> не работает на данной системе.";
  }
$msg .= "<br />";
$dig = message($msg);
return $dig;
}
function win2uni($s)
  {
    $s = convert_cyr_string($s,'w','i'); // преобразование win1251 -> iso8859-5
    // преобразование iso8859-5 -> unicode:
    for ($result='', $i=0; $i<strlen($s); $i++) {
      $charcode = ord($s[$i]);
      $result .= ($charcode>175)?"&#".(1040+($charcode-176)).";":$s[$i];
    }
    return $result;
  }
// Код вывода картинки email адресом для whois
function mailpic($email)
{
$len = (strlen($email))*6;
header ("Content-type: image/gif");
$im = imagecreate($len, 15);
$txt=ImageColorAllocate($im,255,255,255);
$bg=ImageColorAllocate($im,00,00,00);
//	Заливаем фоном
imagefill($im, 0, 0, $txt);
$font=2;
$left=1;
imagestring ($im, $font, $left, $top, $email, $bg);
imagegif($im);
imagedestroy($im);}
function thumbs($url,$size)
{
if($size=="") {$size = "T";}
header ("Content-type: image/jpeg");
$im = imagecreatefromjpeg('http://shots.statmaxx.de/?size='.$size.'&url='.$url);
imagejpeg($im);
imagedestroy($im);}
//## перекодировка win1251 -> unicode (UTF-8) 
//## Тоже самое что и выше, только нет экономии места... 
function win_utf8 ($in_text){ 
$output=""; 
$other[1025]="Ё"; 
$other[1105]="ё"; 
$other[1028]="Є"; 
$other[1108]="є"; 
$other[1030]="I"; 
$other[1110]="i"; 
$other[1031]="Ї"; 
$other[1111]="ї"; 
for ($i=0; $i<strlen($in_text); $i++){ 
if (ord($in_text{$i})>191){ 
  $output.="&#".(ord($in_text{$i})+848).";"; 
} else { 
  if (array_search($in_text{$i}, $other)===false){ 
   $output.=$in_text{$i}; 
  } else { 
   $output.="&#".array_search($in_text{$i}, $other).";"; 
  } 
} 
} 
return $output; 
} 
//## перекодировка unicode UTF-8 -> win1251 
function utf8_win ($s){ 
$out=""; 
$c1=""; 
$byte2=false; 
for ($c=0;$c<strlen($s);$c++){ 
$i=ord($s[$c]); 
if ($i<=127) $out.=$s[$c]; 
if ($byte2){ 
$new_c2=($c1&3)*64+($i&63); 
$new_c1=($c1>>2)&5; 
$new_i=$new_c1*256+$new_c2; 
if ($new_i==1025){ 
$out_i=168; 
}else{ 
if ($new_i==1105){ 
$out_i=184; 
}else { 
$out_i=$new_i-848; 
} 
} 
$out.=chr($out_i); 
$byte2=false; 
} 
if (($i>>5)==6) { 
$c1=$i; 
$byte2=true; 
} 
} 
return $out; 
} 
?>
Сам чекер:
PHP:
// Google PR
define('GOOGLE_MAGIC', 0xE6359A60);
function nooverflow($a)
  {
  while ($a<-2147483648)
     $a+=2147483648+2147483648;
  while ($a>2147483647)
     $a-=2147483648+2147483648;
  return $a;
  }
function zeroFill ($x, $bits)
  {
  if ($bits==0) return $x;
  if ($bits==32) return 0;
  $y = ($x & 0x7FFFFFFF) >> $bits;
  if (0x80000000 & $x)
     {
     $y |= (1<<(31-$bits));
     }
  return $y;
}
function mix($a,$b,$c)
  {
  $a=(int)$a; $b=(int)$b; $c=(int)$c;
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,13));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<8);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,13));
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,12));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<16);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,5));
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,3));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<10);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,15));
  return array($a,$b,$c);
  }
function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC) {
if(is_null($length)) {
$length = sizeof($url);
}
$a = $b = 0x9E3779B9;
$c = $init;
$k = 0;
$len = $length;
while($len >= 12) {
$a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24));
$b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24));
$c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24));
$mix = mix($a,$b,$c);
$a = $mix[0]; $b = $mix[1]; $c = $mix[2];
$k += 12;
$len -= 12;
}
$c += $length;
switch($len) 
{
case 11: $c+=($url[$k+10]<<24);
case 10: $c+=($url[$k+9]<<16);
case 9 : $c+=($url[$k+8]<<8);
case 8 : $b+=($url[$k+7]<<24);
case 7 : $b+=($url[$k+6]<<16);
case 6 : $b+=($url[$k+5]<<8);
case 5 : $b+=($url[$k+4]);
case 4 : $a+=($url[$k+3]<<24);
case 3 : $a+=($url[$k+2]<<16);
case 2 : $a+=($url[$k+1]<<8);
case 1 : $a+=($url[$k+0]);
}
$mix = mix($a,$b,$c);
return $mix[2];
}
function strord($string) {
for($i=0;$i<strlen($string);$i++) {
$result[$i] = ord($string{$i});
}
return $result;
}
function get_pr($url) {
$result=array("",-1);
if (($url.""!="")&&($url.""!="http://")):
if (substr(strtolower($url),0,7)!="http://"):
$url="http://".$url;
endif;
$url="info:".$url;
$checksum=GoogleCH(strord($url));
$google_url=sprintf("http://www.google.com/search?client=navclient&ch=6%u&features=Rank&q=".$url,$checksum); // url to get from google
$handle = @fopen($google_url, "rb");
$contents = '';
if ($handle) {
while (!@feof($handle)) {
 $contents.= @fread($handle, 8192);
}
fclose($handle);
$p=explode(":",$contents);
if (isset($p[2])):
$result=trim($p[2]);
endif;
} else {$result = 0;}
endif;
return($result!="" && (strlen($result)>0 && (strlen($result)<3))?$result:"0");
}
И второй файл func_mp.php Все содержимое файла:
PHP:
<?
error_reporting(E_ALL & ~E_NOTICE);
// Yandex ALL
function getYA($file,$url)
{	
	// тИЦ
	preg_match("/value=\"(.\d*)\"/", $file, $cy);
	$cy = $cy[1]; if ($cy=="") $cy = 0;
	// Rang
	preg_match("/rang=\"(.\d*)\"/", $file, $rang);
	$rang = $rang[1]; if ($rang=="") $rang = 0;
	// Тема сайта (если он в каталоге Яндекса)
	$is_topic = preg_match_all("/Тема: (.*)/", $file, $ya);
		if ($is_topic!="" && $is_topic!=0) {$nextcat = ""; if ($ya[1][2]!="") {$nextcat = ", ".$ya[1][2]; if ($ya[1][3]!="") {$nextcat = ", ".$ya[1][2].", ".$ya[1][3]; if ($ya[1][4]!="") {$nextcat = ", ".$ya[1][2].", ".$ya[1][3].", ".$ya[1][4];}}}
				$topic = "(".$ya[1][1].$nextcat.")";} else {$topic = " ";}
	// Проверка на наличие в каталоге Яндекса
	$yacaUrl = preg_match("/url=\"(.*)\"/", $file, $yaca);
		if ($yacaUrl) {$yaca = "Да";} else {$yaca = "Нет";}
	// Определение склейки параметров по тИЦ
	preg_match("/url domain=\"(.*)\"/", $file, $stick);
		if (strcmp("www.",substr($stick[1],0,4))==0) {$stick[1] = substr($stick[1],4,strlen($stick[1])-4);}
		if (strcmp("www.",substr($url,0,4))==0) {$url = substr($url,4,strlen($url)-4);}
		if (!stristr($url,$stick[1]) && $stick[1]!="") {$stick = $stick[1];} else {$stick[1] = ""; $stick = $stick[1];}
	return array($cy,$rang,$yaca,$stick,$topic);
}
function yaUrl($url)
{
$urlToBar = "http://bar-navig.yandex.ru/u?ver=2&show=32&url=http://".$url;
return array($urlToBar,$url);
}
// Webalta WTR и WR
function getWebalta($file,$url)
{
	preg_match("/\n(.\d*){1,2} (.\d*){1,3}/",$file,$buffer);
	$altaWTR = $buffer[1];
	$altaWR = $buffer[2];
	//if ($altaWTR=="") $altaWTR = 0;
	//if ($altaWR=="") $altaWR = 0;
	return array($altaWTR,$altaWR);
}
function webaltaUrl($url)
{
$urlToFile = "http://www.webalta.ru/reliance?url=".$url;
return array($urlToFile,$url);
}
// Наличие в каталоге dmoz (odp)
function getDmoz($file,$url)
{
	$findStr = strpos($file, "match");
	if ($findStr) {$found = "Да";} else {$found = "Нет";}
	return $found;
}
function dmozUrl($url)
{
$url = str_replace("www.","",$url);
$urlToSite = "http://search.dmoz.org/cgi-bin/search?search=".$url;
return array($urlToSite,$url);
}
// Массив с хостами google для того чтобы не блокировали
$googleArr = array("www.google.com","www.google.ru");
$uniq = mt_rand(0,1);
$googleHost = $googleArr[$uniq];
// Кол-во проиндексированных в google страниц (с www и без)
function getIndexGoogle($buffer,$url)
{
	$indexStand = preg_match("/Results <b>(.*){1}<\/b> - <b>(.*){1}<\/b> of about <b>(.*)<\/b> from <b>/i", $buffer, $indexG);
	if ($indexStand) {$indexed = $indexG[3];}
	else {$indexMini = preg_match("/Results <b>(.*){1}<\/b> - <b>(.*){1}<\/b> of <b>(.*)<\/b> from <b>/i", $buffer, $indexG);
	if ($indexMini) {$indexed = $indexG[3];} else {$indexed = 0;} }
	$indexed = str_replace(",","",$indexed);
	$indexed = str_replace(" ","",$indexed);
	$indexed = str_replace("&nbsp;","",$indexed);
	return (int)$indexed;
}
function indexGoogleUrl($url)
{global $googleHost;
$urlToSite = "http://".$googleHost."/search?q=site:".$url."&hl=en&lr=&ie=UTF-8&filter=0&btnG=Search";
return array($urlToSite,$url);
}
// Кол-во проиндексированных в Яндекс страниц (с www и без)
function getIndexYa($file,$url)
{
	preg_match("/Яndex:  \((.*)\)/i", $file, $indexYa);
	$indexed = $indexYa[1];
	if ($indexed=="") $indexed = 0;
	$indexed = str_replace("&nbsp;","",$indexed);
	$indexed = str_replace(",","",$indexed);
	$indexed = str_replace(" ","",$indexed);
	return (int)$indexed;
}
function indexYaUrl($url)
{
$urlToSite = "http://www.yandex.ru/yandsearch?surl=".$url."&pag=u&numdoc=10&rd=0";
return array($urlToSite,$url);
}
// Кол-во беклинков в Google
function getBackGoogle($file,$url)
{
	$backStand = preg_match("/Results <b>(.*){1}<\/b> - <b>(.*){1}<\/b> of about <b>(.*)<\/b> linking to <b>$url<\/b>/i", $file, $linksG);
	if ($backStand) {$backlinks = $linksG[3];}
	else {$backMini = preg_match("/Results <b>(.*){1}<\/b> - <b>(.*){1}<\/b> of <b>(.*)<\/b> linking to <b>$url<\/b>/i", $file, $linksG);
	if ($backMini) {$backlinks = $linksG[3];} else {$backlinks = 0;} }
	$backlinks = str_replace(",","",$backlinks);
	$backlinks = str_replace(" ","",$backlinks);
	$backlinks = str_replace("&nbsp;","",$backlinks);
	return (int)$backlinks;
}
function backGoogleUrl($url)
{global $googleHost;
$urlToSite = "http://".$googleHost."/search?hl=en&lr=&q=link%3A".$url."&btnG=Search";
return array($urlToSite,$url);
}
// Кол-во беклинков со страниц и с сайтов в Яндекс
function getBackYa($file,$url)
{
	preg_match("/Результат поиска: страниц&nbsp;&mdash; <b>(.*)<\/b>,/", $file, $backPages); // страницы
	preg_match("/сайтов&nbsp;&mdash; не менее <b>(.*)<\/b><br \/>/", $file, $backSites); // сайты
	if ($backPages[1] == "") $backPages[1] = 0;
	if ($backSites[1] == "") $backSites[1] = 0;
	$backPages = $backPages[1];
	$backSites = $backSites[1];
	$backPages = str_replace("&nbsp;","",$backPages);
	$backPages = str_replace(",","",$backPages);
	$backPages = str_replace(" ","",$backPages);
	$backSites = str_replace("&nbsp;","",$backSites);
	$backSites = str_replace(",","",$backSites);
	$backSites= str_replace(" ","",$backSites);
	return array($backPages,$backSites);
}
function backYaUrl($url)
{
$urlToSite = "http://www.yandex.ru/yandsearch?Link=".$url."&numdoc=10&rd=0";
return array($urlToSite,$url);
}
// Кол-во беклинков в Rambler
function getBackRambler($buffer,$url)
{ 
	preg_match("/документов:&nbsp;<b>(.*)<\/b>/", $buffer, $backPages); // страницы
	preg_match("/<\/nobr>найдено&nbsp;сайтов:&nbsp;<b>(.*)<\/b>/", $buffer, $backSites); // сайты
	if ($backPages[1] == "") $backPages[1] = 0;
	if ($backSites[1] == "") $backSites[1] = 0;
	$backPages = $backPages[1];
	$backSites = $backSites[1];
	$backPages = str_replace("&nbsp;","",$backPages);
	$backPages = str_replace(",","",$backPages);
	$backPages = str_replace(" ","",$backPages);
	$backSites = str_replace("&nbsp;","",$backSites);
	$backSites = str_replace(",","",$backSites);
	$backSites= str_replace(" ","",$backSites);
	$backPages = str_replace("<b>","",$backPages);
	$backPages = str_replace("</b>","",$backPages);
	$backPages = str_replace("новых:","",$backPages);
	$backSites = str_replace("<b>","",$backSites);
	$backSites = str_replace("</b>","",$backSites);
	$backSites= str_replace("новых:","",$backSites);
	return array((int)$backPages,(int)$backSites);
}
function backRamblerUrl($url)
{
$urlToSite = "http://search.rambler.ru/srch?words=".$url."&news=2";
return array($urlToSite,$url);
}
function cleanInput($string)
{
	$string = str_replace("<script","",$string);
	$string = str_replace("<frame","",$string);
	$string = str_replace("<object","",$string);
	$string = str_replace("<iframe","",$string);	
	$string = str_replace("<applet","",$string);
	$string = str_replace("<meta","",$string);
	$string = str_replace("\|","",$string);
	$string = str_replace("\'","",$string);
	$string = str_replace("|","",$string);
	$string = str_replace("'","",$string);
	$string = stripslashes(strip_tags($string));
	// Удаление http:// из адреса домена и последнего слеша
	if (strcmp("http://",substr($string,0,7))==0)
	{$string=substr($string,7,strlen($string)-7);}
	if (strcmp("https://",substr($string,0,8))==0)
	{$string=substr($string,8,strlen($string)-8);}
	$string = preg_replace("/\/(.*)/","",$string);
	return $string;
}
// ФУНКЦИИ ДЛЯ БАЗЫ ДАННЫХ И АДМИНКИ
function getSqlRow($query) {
	$result = mysql_query($query) or echoErr();
	$row = mysql_fetch_array($result);
	mysql_free_result($result);
	return $row;
}
function getSqlNumber($sqlQuery) {
	$query=@mysql_query($sqlQuery);
	$result=@mysql_num_rows($query);
	@mysql_free_result($query);
	return $result;
}
function getFullDate($date) {
	$date = date('l dS of F Y h:i:s A', $date);
	return $date;
}
function getMinDate($date) {
	$date = date('d.m.Y', $date);
	return $date;
}
function win2uni($s)
  {
    $s = convert_cyr_string($s,'w','i'); // преобразование win1251 -> iso8859-5
    // преобразование iso8859-5 -> unicode:
    for ($result='', $i=0; $i<strlen($s); $i++) {
      $charcode = ord($s[$i]);
      $result .= ($charcode>175)?"&#".(1040+($charcode-176)).";":$s[$i];
    }
    return $result;
  }
//## перекодировка win1251 -> unicode (UTF-8) 
//## Тоже самое что и выше, только нет экономии места... 
function win_utf8 ($in_text){ 
$output=""; 
$other[1025]="Ё"; 
$other[1105]="ё"; 
$other[1028]="Є"; 
$other[1108]="є"; 
$other[1030]="I"; 
$other[1110]="i"; 
$other[1031]="Ї"; 
$other[1111]="ї"; 
for ($i=0; $i<strlen($in_text); $i++){ 
if (ord($in_text{$i})>191){ 
  $output.="&#".(ord($in_text{$i})+848).";"; 
} else { 
  if (array_search($in_text{$i}, $other)===false){ 
   $output.=$in_text{$i}; 
  } else { 
   $output.="&#".array_search($in_text{$i}, $other).";"; 
  } 
} 
} 
return $output; 
} 
//## перекодировка unicode UTF-8 -> win1251 
function utf8_win ($s){ 
$out=""; 
$c1=""; 
$byte2=false; 
for ($c=0;$c<strlen($s);$c++){ 
$i=ord($s[$c]); 
if ($i<=127) $out.=$s[$c]; 
if ($byte2){ 
$new_c2=($c1&3)*64+($i&63); 
$new_c1=($c1>>2)&5; 
$new_i=$new_c1*256+$new_c2; 
if ($new_i==1025){ 
$out_i=168; 
}else{ 
if ($new_i==1105){ 
$out_i=184; 
}else { 
$out_i=$new_i-848; 
} 
} 
$out.=chr($out_i); 
$byte2=false; 
} 
if (($i>>5)==6) { 
$c1=$i; 
$byte2=true; 
} 
} 
return $out; 
} 
// Google PR
define('GOOGLE_MAGIC', 0xE6359A60);
function nooverflow($a)
  {
  while ($a<-2147483648)
     $a+=2147483648+2147483648;
  while ($a>2147483647)
     $a-=2147483648+2147483648;
  return $a;
  }
function zeroFill ($x, $bits)
  {
  if ($bits==0) return $x;
  if ($bits==32) return 0;
  $y = ($x & 0x7FFFFFFF) >> $bits;
  if (0x80000000 & $x)
     {
     $y |= (1<<(31-$bits));
     }
  return $y;
}
function mix($a,$b,$c)
  {
  $a=(int)$a; $b=(int)$b; $c=(int)$c;
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,13));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<8);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,13));
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,12));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<16);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,5));
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,3));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<10);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,15));
  return array($a,$b,$c);
  }
function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC) {
if(is_null($length)) {
$length = sizeof($url);
}
$a = $b = 0x9E3779B9;
$c = $init;
$k = 0;
$len = $length;
while($len >= 12) {
$a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24));
$b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24));
$c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24));
$mix = mix($a,$b,$c);
$a = $mix[0]; $b = $mix[1]; $c = $mix[2];
$k += 12;
$len -= 12;
}
$c += $length;
switch($len) 
{
case 11: $c+=($url[$k+10]<<24);
case 10: $c+=($url[$k+9]<<16);
case 9 : $c+=($url[$k+8]<<8);
case 8 : $b+=($url[$k+7]<<24);
case 7 : $b+=($url[$k+6]<<16);
case 6 : $b+=($url[$k+5]<<8);
case 5 : $b+=($url[$k+4]);
case 4 : $a+=($url[$k+3]<<24);
case 3 : $a+=($url[$k+2]<<16);
case 2 : $a+=($url[$k+1]<<8);
case 1 : $a+=($url[$k+0]);
}
$mix = mix($a,$b,$c);
return $mix[2];
}
function strord($string) {
for($i=0;$i<strlen($string);$i++) {
$result[$i] = ord($string{$i});
}
return $result;
}
function get_pr($url) {
$result=array("",-1);
if (($url.""!="")&&($url.""!="http://")):
if (substr(strtolower($url),0,7)!="http://"):
$url="http://".$url;
endif;
$url="info:".$url;
$checksum=GoogleCH(strord($url));
$google_url=sprintf("http://www.google.com/search?client=navclient&ch=6%u&features=Rank&q=".$url,$checksum); // url to get from google
$handle = @fopen($google_url, "rb");
$contents = '';
if ($handle) {
while (!@feof($handle)) {
 $contents.= @fread($handle, 8192);
}
fclose($handle);
$p=explode(":",$contents);
if (isset($p[2])):
$result=trim($p[2]);
endif;
} else {$result = 0;}
endif;
return($result!="" && (strlen($result)>0 && (strlen($result)<3))?$result:"0");
}
?>
И сам чекер:
PHP:
// Google PR
define('GOOGLE_MAGIC', 0xE6359A60);
function nooverflow($a)
  {
  while ($a<-2147483648)
     $a+=2147483648+2147483648;
  while ($a>2147483647)
     $a-=2147483648+2147483648;
  return $a;
  }
function zeroFill ($x, $bits)
  {
  if ($bits==0) return $x;
  if ($bits==32) return 0;
  $y = ($x & 0x7FFFFFFF) >> $bits;
  if (0x80000000 & $x)
     {
     $y |= (1<<(31-$bits));
     }
  return $y;
}
function mix($a,$b,$c)
  {
  $a=(int)$a; $b=(int)$b; $c=(int)$c;
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,13));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<8);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,13));
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,12));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<16);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,5));
  $a -= $b; $a -= $c; $a=nooverflow($a); $a ^= (zeroFill($c,3));
  $b -= $c; $b -= $a; $b=nooverflow($b); $b ^= ($a<<10);
  $c -= $a; $c -= $b; $c=nooverflow($c); $c ^= (zeroFill($b,15));
  return array($a,$b,$c);
  }
function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC) {
if(is_null($length)) {
$length = sizeof($url);
}
$a = $b = 0x9E3779B9;
$c = $init;
$k = 0;
$len = $length;
while($len >= 12) {
$a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24));
$b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24));
$c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24));
$mix = mix($a,$b,$c);
$a = $mix[0]; $b = $mix[1]; $c = $mix[2];
$k += 12;
$len -= 12;
}
$c += $length;
switch($len) 
{
case 11: $c+=($url[$k+10]<<24);
case 10: $c+=($url[$k+9]<<16);
case 9 : $c+=($url[$k+8]<<8);
case 8 : $b+=($url[$k+7]<<24);
case 7 : $b+=($url[$k+6]<<16);
case 6 : $b+=($url[$k+5]<<8);
case 5 : $b+=($url[$k+4]);
case 4 : $a+=($url[$k+3]<<24);
case 3 : $a+=($url[$k+2]<<16);
case 2 : $a+=($url[$k+1]<<8);
case 1 : $a+=($url[$k+0]);
}
$mix = mix($a,$b,$c);
return $mix[2];
}
function strord($string) {
for($i=0;$i<strlen($string);$i++) {
$result[$i] = ord($string{$i});
}
return $result;
}
function get_pr($url) {
$result=array("",-1);
if (($url.""!="")&&($url.""!="http://")):
if (substr(strtolower($url),0,7)!="http://"):
$url="http://".$url;
endif;
$url="info:".$url;
$checksum=GoogleCH(strord($url));
$google_url=sprintf("http://www.google.com/search?client=navclient&ch=6%u&features=Rank&q=".$url,$checksum); // url to get from google
$handle = @fopen($google_url, "rb");
$contents = '';
if ($handle) {
while (!@feof($handle)) {
 $contents.= @fread($handle, 8192);
}
fclose($handle);
$p=explode(":",$contents);
if (isset($p[2])):
$result=trim($p[2]);
endif;
} else {$result = 0;}
endif;
return($result!="" && (strlen($result)>0 && (strlen($result)<3))?$result:"0");
}
В чекере урл не корректен. Если кто знает решение проблемы подскажите плиз.
Заранее искренне благодарен.
П.С. Также буду благодарен если кто поделится скриптами или ссылками на скрипты для сео или веб-мастеров.
 
Вот рабочий вариант:
PHP:
<?php
/*
Joe Abi Raad
12.11.2007
Functions used in pagerank
*/
function stringord($string) {
 for($i=0;$i<strlen($string);$i++) {
   $result[$i] = ord($string{$i});
 }
 return $result;
}
function GoogleCH($url, $length=null) {
 $url=stringord($url);
 if(is_null($length)) {
	$length = sizeof($url);
 }
 $a = $b = 0x9E3779B9;
 $c = 0xE6359A60; # GOOGLE MAGIC
 $k = 0;
 $len = $length;
 while($len >= 12) {
	$a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24));
	$b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24));
	$c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24));
	$mix = mix($a,$b,$c);
	$a = $mix[0]; $b = $mix[1]; $c = $mix[2];
	$k += 12;
	$len -= 12;
 }

 $c += $length;

 switch($len) /* all the case statements fall through */
 {
	case 11: $c+=($url[$k+10]<<24);
	case 10: $c+=($url[$k+9]<<16);
	case 9 : $c+=($url[$k+8]<<8);
	/* the first byte of c is reserved for the length */
	case 8 : $b+=($url[$k+7]<<24);
	case 7 : $b+=($url[$k+6]<<16);
	case 6 : $b+=($url[$k+5]<<8);
	case 5 : $b+=($url[$k+4]);
	case 4 : $a+=($url[$k+3]<<24);
	case 3 : $a+=($url[$k+2]<<16);
	case 2 : $a+=($url[$k+1]<<8);
	case 1 : $a+=($url[$k+0]);
	/* case 0: nothing left to add */
 }
 $mix = mix($a,$b,$c);
 /*-------------------------------------------- report the result */
 return $mix[2];
}
function zeroFill($a, $b) {
 $z = hexdec(80000000);
 if ($z & $a) {
	$a = ($a>>1);
	$a &= (~$z);
	$a |= 0x40000000;
	$a = ($a>>($b-1));
 } else {
	$a = ($a>>$b);
 }
 return $a;
}

function mix($a,$b,$c) {
 $a -= $b; $a -= $c; $a ^= (zeroFill($c,13));
 $b -= $c; $b -= $a; $b ^= ($a<<8);
 $c -= $a; $c -= $b; $c ^= (zeroFill($b,13));
 $a -= $b; $a -= $c; $a ^= (zeroFill($c,12));
 $b -= $c; $b -= $a; $b ^= ($a<<16);
 $c -= $a; $c -= $b; $c ^= (zeroFill($b,5));
 $a -= $b; $a -= $c; $a ^= (zeroFill($c,3));
 $b -= $c; $b -= $a; $b ^= ($a<<10);
 $c -= $a; $c -= $b; $c ^= (zeroFill($b,15));

 return array($a,$b,$c);
}
function isurl($strng){
 return preg_match('/^http:\/\/[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/i',$strng);
}
### MAIN FUNCTION ###
function getPageRank($url){
 if (!isurl($url) ){
 	return "<font color=#ff0000>Error: Not a valid URL !</font>";
 }
 $url="info:".((substr(strtolower($url),0,7)!="http://")? "http://".$url:$url);
 $GoogleCH=GoogleCH($url);
 
 $url_cont = sprintf("client=navclient-auto&ch=6%u",$GoogleCH);
 $url_cont .= "&features=Rank&q=".urlencode($url);
 ## final url ##
 $url = "http://www.google.com/search?".$url_cont;
 ##
 #echo $url."<br>";
 #$url= "http://www.google.com/search?client=navclient-auto&ch=62715026412&features=Rank&q=info%3Ahttp%3A%2F%2Fwww.joeabiraad.com";
 $f=fopen($url,r);
 $ret=fread($f,1024);

 $res=explode(":",$ret);
 return "Your google pagerank is: <font color=#ff0000>".$res[2]."</font>";
}
#####################
echo getPageRank('http://www.nulled.cc'); # применение
?>
Если при запуске на 64-разрядной системе не заработает, тогда читать
Также буду благодарен если кто поделится скриптами или ссылками на скрипты для сео или веб-мастеров.
Для просмотра ссылки Войди или Зарегистрируйся ;)
 
Назад
Сверху