Файл: servis/raiting/index.php
Строк: 256
<?php
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
$set['title']='Проверка ТИЦ и PR';//здесь пишем название страници
include_once '../../sys/inc/thead.php';
title();
err();
aut(); // это авторизация,если не нужна ставим два слэша,как перед этой строкой (//)- безскобок
if(isset($_GET['mod']))
{
$mod = $_GET['mod'];
}
else
{
$mod = "";
}
switch($mod)
{
case 'get':
$who=$_POST['who'];
if (eregi("([-a-zA-Zа-яА-Я0-9]{1,63})([.]{1})([a-zA-Zа-яА-Я]{1,10})", $who) or eregi("([w]{1,3})([.]{1})([-a-zA-Zа-яА-Я0-9]{1,63})([.]{1})([a-zA-Zа-яА-Я]{1,10})", $who) or eregi("([-a-zA-Zа-яА-Я0-9]{1,63})([.]{1})([-a-zA-Zа-яА-Я0-9]{1,63})([.]{1})([a-zA-Zа-яА-Я]{1,10})", $who))
{
///////////////////////////ФУНКЦИИ
//тИЦ gjkexftv
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);
}
}
// Массив с хостами 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.0rn";
$out .= "Host: $hostrn";
$out .= "Referer: $host$pathrn";
$out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)rn";
$out .= "Connection: Closern";
$out .= "rn";
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(" ","",$indexed);
return (int)$indexed;
}
// 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) /* 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 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");
}
// Кол-во проиндексированных в yandex
function getIndexYa($url)
{
$host = "yandex.ru";
$path = "/yandsearch?serverurl=$url&lr=187";
$buffer = true;
$fp = @fsockopen("tcp://".$host, 80, $errno, $errstr, 10);
if (!$fp) {return 0;}
else {
$out = "GET $path HTTP/1.1rn";
$out .= "Host: $hostrn";
$out .= "Referer: $host$pathrn";
$out .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)rn";
$out .= "Connection: Closern";
$out .= "rn";
fwrite($fp, $out);
while (!feof($fp)) {
$buffer .= fgets($fp, 1024);
}
fclose($fp);
}
preg_match("/нашлось([^/]+)стран/i", $buffer, $indexy);
$indexed = $indexy[1];
if ($indexed ==''){ $indexed = 'Check';}
$indexed = str_replace(" ","",$indexed);
$indexed = str_replace(",","",$indexed);
$indexed = str_replace(" ","",$indexed);
return $indexed;
}
///////////////////////////////////КОНЕЦ ФУНКЦЫЙ
$yandexArr = getYA($who);
$getpr = get_pr($who);
$indexYandex = getIndexYa($who);
$indexGoogle = getIndexGoogle($who);
echo 'Google PR: <b>'.$getpr.'</b>/10<br/>';
print "Проиндексированные страницы: <u><a href="http://www.google.com/search?q=site:".$who."&hl=ru&lr=&ie=UTF-8&filter=0">".$indexGoogle."</a></u><hr/>";
print "Яндекс тИЦ: <b><a href="http://search.yaca.yandex.ru/yca/cy/ch/".$who."">".$yandexArr[0]."</a></b>";
print "<br/>Проиндексированные страницы: <u><a href="http://www.yandex.ru/yandsearch?serverurl=".$who."">".$indexYandex."</a></u><hr/>";
}
else{
echo'Адрес указан не верно<br/>';
echo'<a href="index.php">Назад</a>';
}
break;
default:
echo'<form action="index.php?mod=get" method="post">';
echo'Адрес сайта: (без http://)<br/><input type="text" name="who"><br/>';
echo'<input type="submit" value="Проверить">';
echo'</form>';
echo "<div class='anton'><img src='/style/icons/st.png' alt='' /> <a href='/servis/index.php'>В Раздел</a></div>";
break;
}
include_once '../../sys/inc/tfoot.php';
?>