Google PageRank query, batch query, identify true and false

Source: Internet
Author: User
Tags explode hash mysql tutorial php tutorial strlen trim

$q =trim ($_get[' Q ']);
$SD = (int) trim ($_get[' SD '));
$t = (int) trim ($_get[' t ']);
if (Strstr ($q, "")) {
$isulist = 1;
$ulist =explode ("", $q);
for ($i =0; $i <count ($ulist); $i + +) {
$domain = ';
$domain =matchdomain ($ulist [$i]);
if ($domain <> ') {
$q 2.= $domain. " ";
}
}
$ulist =explode ("", $q 2);
}else{
$q 2=matchdomain ($q);
}

<div class=contentbox>
<div class= "Content_nav" ><span class= "tt" >google PageRank query </span></div>
<div class=toolitem>
<br><form action= "" method= "get" >
<table style= "Vertical-align:middle;" ><tr><td>
Domain Name: </td><td><textarea rows= "5" cols= "style=" border:1px solid RGB (126, 157, 185); Background-color:white id= "Query" name= "Q" autocomplete= "Off" type= "text" >
<?php Tutorial
if ($q 2<> "") {
echo $q 2;
}else{
echo "Www.111cn.net tool.111cn.net down.111cn.net baidu.com google.com";
}
?>
</textarea>
</td><td>
<input type= "checkbox" name= "SD" value= "1"
<?php if ($sd ==1) {echo ' checked= ' checked ';}?>
/> Query Two-level domain name PR
<br><input type= "checkbox" Name= "T" value= "1"
<?php if ($t ==1) {echo ' checked= ' checked ';}?>
/> distinguish between true and false
</td><td>
<span class= "Backgroundbord" ><button class= "Srh_onesearch" type= "submit" > Enquiry </button></span >
</td></table>
</form>
</div>
</div>
<?php
Require_once '.. /ad/mid.php ';
if ($q 2== ') {
?>
<div class=contentbox>
<div class= "Content_nav" ><span class= "tt" > Tools Description </span></div>
<div class=topmenuitem>
<p> Please enter a domain name, such as chaxun.la. <br> Multi-domain query Please enter a domain name for each line, there is no limit on the number of domain names! <br><font color=red> query level two domain name pr:</font> will query the domain name of the two-level domain name PR. (Two-level domain name through the query site database tutorial to obtain, not comprehensive!) <br><font color=red> identification of true and false:</font> will identify the domain name of the PR is hijacked other website Pr. </p>
</div>
</div>

<?php
}else{
echo "<div class=contentbox>";
Echo ' <div class= "Content_nav" ><span class= "tt" > Query result </span></div> ';
echo "<div class=topmenuitem>";
Echo ' <span style= ' width=200px;text-align:right;padding-right:50px; > Domain </span><span class= "span_iframe" >PR</span>;
if ($t) {echo ' <span class= ' SPAN_IFRAME_PR ' > Identify true </span> ';}
Echo ' <br> ';
if ($isulist) {
For ($JJ =0 $jj <count ($ulist)-1; $JJ + +) {
$ch =get_pagerank (' http://'. $ulist [$JJ]);
Echo ' <span style= ' width=200px;text-align:right;padding-bottom:6px; ><a target= "_blank" href= "http://'. $ulist [$JJ]. '" ><font color=red> '. $ulist [$JJ]. ' </font></a>:</span><span class= "Span_iframe" ><iframe src= "http://" toolbarqueries.google.com/search?client=navclient-auto&googleip=o;937&ie=utf-8&oe=utf-8& Features=rank&ch= '. $ch. ' &q=info: '. $ulist [$JJ]. "Width=" height= "scrolling=" no "marginheight=" 0 " Marginwidth= "0" frameborder= "0" class= "iframe" ></iframe></span>;
if ($t) {echo ' <span class= "SPAN_IFRAME_PR" ><iframe src= "tfpr.php?q=". $ulist [$JJ]. "Width=" height= "20" Scrolling= "No" marginheight= "0" marginwidth= "0" frameborder= "0" ></iframe></span>}
Echo ' <br> ';
if ($SD) {
Read the two-level domain name of this domain from the database
$topdomain =topdomain ($ulist [$JJ]);
$sql = "Select domain from c_domainlist where topdomain= ' $topdomain ' and domain<> ' $ulist [$JJ] ' ORDER by domain";
$result =mysql Tutorial _query ($sql);
Or Die (Mysql_error ());
while ($row =mysql_fetch_array ($result)) {
$ch =get_pagerank (' http://'. $row [' domain ']);
Echo ' <span style= ' width=200px;text-align:right;padding-bottom:6px; ><a target= "_blank" href= "http://'. $row [' domain ']. '" > '. $row [' domain ']. ' </a>:</span><span class= "Span_iframe" ><iframe src= "Http://toolbarqueries.google.com/search"? Client=navclient-auto&googleip=o;937&ie=utf-8&oe=utf-8&features=rank&ch= '. $ch. ' &q=info : '. $row [' domain ']. ' "Width=" height= "scrolling=" no "marginheight=" 0 "marginwidth=" 0 "frameborder=" 0 "class=" iframe "></iframe></span>";
if ($t) {echo ' <span class= ' span_iframe_pr ' ><iframe src= ' tfpr.php?q= '. $row [' domain ']. ' Width= ' height= "Scrolling=" no "marginheight=" 0 "marginwidth=" 0 "frameborder=" 0 "></iframe></span>";
Echo ' <br> ';
}
}
}
}else{
$ch =get_pagerank (' http://'. $q 2);
Echo ' <span style= ' width=200px;text-align:right;padding-bottom:6px; ><a target= "_blank" href= "http://'. $q 2. '" ><font color=red> '. $q 2. ' </font></a>:</span><span class= "Span_iframe" ><iframe src= "http://" toolbarqueries.google.com/search?client=navclient-auto&googleip=o;937&ie=utf-8&oe=utf-8& Features=rank&ch= '. $ch. ' &q=info: '. $q 2. ' "Width=" "height=" scrolling= "no" marginheight= "0" marginwidth = "0" frameborder= "0" class= "iframe" ></iframe></span>;
if ($t) {echo ' <span class= ' span_iframe_pr ' ><iframe src= ' tfpr.php?q= '. $q 2. ' Width= ' height= ' 20 ' Scrolling= "No" marginheight= "0" marginwidth= "0" frameborder= "0" ></iframe></span>}
Echo ' <br> ';
if ($SD) {
Read the two-level domain name of this domain from the database
$topdomain =topdomain ($q 2);
$sql = "Select domain from c_domainlist where topdomain= ' $topdomain ' and domain<> ' $q 2 ' ORDER by domain";
$result =mysql_query ($sql);
Or Die (Mysql_error ());
while ($row =mysql_fetch_array ($result)) {
$ch =get_pagerank (' http://'. $row [' domain ']);
Echo ' <span style= ' width=200px;text-align:right;padding-bottom:6px; ><a target= "_blank" href= "http://'. $row [' domain ']. '" > '. $row [' domain ']. ' </a>:</span><span class= "Span_iframe" ><iframe src= "Http://toolbarqueries.google.com/search"? Client=navclient-auto&googleip=o;937&ie=utf-8&oe=utf-8&features=rank&ch= '. $ch. ' &q=info : '. $row [' domain ']. ' "Width=" height= "scrolling=" no "marginheight=" 0 "marginwidth=" 0 "frameborder=" 0 "class=" iframe "></iframe></span>";
if ($t) {echo ' <span class= ' span_iframe_pr ' ><iframe src= ' tfpr.php?q= '. $row [' domain ']. ' Width= ' height= "Scrolling=" no "marginheight=" 0 "marginwidth=" 0 "frameborder=" 0 "></iframe></span>";
Echo ' <br> ';
}
}
}
echo "</div></div>";
}
function Get_pagerank ($permalink) {
$GPR = new PageRank ();
return $GPR->ch ("$permalink");
}

Class pagerank{
7/25/2008-updated by Askie (http://www.pkphp.com/)
3/20/2008-updated by Roger Collins (http://www.rogercollins.com/)
To remove graphing step

PageRank Lookup v1.1 by hm2k (update:31/01/07)
Based on a Alogoritham found here:http://pagerank.gamesaga.net/

Settings-host and User Agent
var $googlehost = ' toolbarqueries.google.com ';
var $googleua = ' mozilla/5.0 (Windows; U Windows NT 5.1; En-us; rv:1.8.0.6) gecko/20060728 firefox/1.5 ';

Convert a string to a 32-bit integer
function Strtonum ($Str, $Check, $Magic) {
$Int 32Unit = 4294967296; 2^32

$length = strlen ($STR);
for ($i = 0; $i < $length; $i + +) {
$Check *= $Magic;
If the float is beyond the boundaries of integer (usually-+-2.15e+9 = 2^31),
The result of converting to the-integer is undefined
Refer to Http://www.php.net/manual/en/language.types.integer.php
if ($Check >= $Int 32Unit) {
$Check = ($Check-$Int 32Unit * (int) ($Check/$Int 32Unit));
If the check less than-2^31
$Check = ($Check <-2147483648)? ($Check + $Int 32Unit): $Check;
}
$Check + + ord ($Str {$i});
}
return $Check;
}

Genearate a hash for a URL
function Hashurl ($String) {
$Check 1 = $this->strtonum ($String, 0x1505, 0x21);
$Check 2 = $this->strtonum ($String, 0, 0x1003f);

     $Check 1 >>= 2;    
     $Check 1 = ($ Check1 >> 4) & 0X3FFFFC0 | ($Check 1 & 0x3F);
     $Check 1 = (($Check 1 >> 4) & 0X3FFC00 | ($Check 1 & 0x3ff);
     $Check 1 = (($Check 1 >> 4) & 0x3c000 | ($Check 1 & 0x3fff);   
    
     $T 1 = ((($Check 1 & 0x3c0) << 4) | ($Check 1 & 0x3c)) <<2) | ($Check 2 & 0xf0f);
     $T 2 = ((($Check 1 & 0xffffc000) << 4 | ($Check 1 & 0x3c00)) << 0xA) | ($Check 2 & 0xf0f0000);
    
     return ($T 1 | $T 2);
 

 //genearate a checksum for the hash string
 function Checkhash ($Hashnum) {
      $CheckByte = 0;
     $Flag = 0;

     $HashStr = sprintf ('%u ', $Hashnum);
     $length = strlen ($HASHSTR);
    
     for ($i = $length -1;  $i >= 0;  $i--) {
&N bsp;        $Re = $HashStr {$i};
         if (1 = = ($Flag% 2)) {              
              $Re + + $Re;    
              $Re = (int) ($Re/10) + ($Re% 10);
        }
         $CheckByte + + $Re;
         $Flag ++;   
    }

$CheckByte%= 10;
if (0!== $CheckByte) {
$CheckByte = 10-$CheckByte;
if (1 = = ($Flag% 2)) {
if (1 = = ($CheckByte% 2)) {
$CheckByte + 9;
}
$CheckByte >>= 1;
}
}

Return ' 7 ' $CheckByte. $HashStr;
}

Return the PageRank checksum hash
function Getch ($url) {return $this->checkhash ($this->hashurl ($url));}

 //return The PageRank figure
 function Ch ($url) {
   $urlinfo =parse_url ($url);
     $start = $urlinfo ["scheme"]<> "" Strlen ($urlinfo ["scheme"]. ":/ /"): 0;
   $url =substr ($url, $start);
  
   $PR = 0;   //default return
     $ch = $this-& Gt;getch ($url);
  return $ch;
 }
}

$q =trim ($_get[' Q ']);
//for ($i =0 $i <5; $i + +) {
$pagecode = @file_get_contents ("Http://www.google.cn/search?q=info:". $q);
 //   if ($pagecode) {
// break
// }
//}
    if ($pagecode) {
  preg_match ('/<cite> (. *?) ', $pagecode, $GOOGLEPR);
  if ($q = = $googlepr [1] or STRSTR ($googlepr [1], '. '). $Q) or strstr ($q, '. '). $GOOGLEPR [1])) {
   echo ' <font style= "color:green;font-weight:bold;" >√</font> ';
  }elseif ($q <> $googlepr [1] and $googlepr [1]<> ') {
   echo ' <font Style= "Color:red;font-weight:bold;" >x</font>, this site may hijack '. $googlepr [1]. ' The pr! ';
  }elseif ($googlepr [1]== ') {
   echo ' search info at Google: '. $q. ' No information! ';
  }
 }else{
 echo "failed to get Google info!" ";  
 }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.