·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设问答 >> 用书签查询网站pr值

用书签查询网站pr值

作者:佚名      网站建设问答编辑:admin      更新时间:2022-07-23

在chrome或者firefox都有pr查询工具,访问某个网页的时候,自动显示当前网站的pr值。

但并不是所有的页面都需要查询,于是弄了一个查询pr的书签,仅在需要查询的时候,再点击查询。

javascript:(function()%7Bvar%20d=document;var%20l=location;var%20u=l.toString();var%20s=d.createElement('script');var%20b='http://uicss.cn/pr/';var%20n=b+'url.php?'+'&url='+encodeURIComponent(u);window.open(n);%7D)();

使用方法:

添加上面的js代码到自己的书签就可以了。在需要查询pr的网址,直接点书签即可:

全文已经结束。

附url.php的实现思路:

<?php
$url = $_GET['url'];
$html_url = htmlspecialchars($url);
 
function HashURL($url)
{$SEED = "Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE.";
    $Result = 0x01020345;
    for ($i=0; $i<strlen($url); $i++)
    {
        $Result ^= ord($SEED{$i%87}) ^ ord($url{$i});
        $Result = (($Result >> 23) & 0x1FF) | $Result << 9;
    }
    return sprintf("8%x", $Result);
}
 
function pagerank($domain)
{  
    $StartURL = "http://toolbarqueries.google.com/tbr?client=navclient-auto&features=Rank:&q=info:";
    $GoogleURL = $StartURL.$domain. '&ch='.HashURL($domain);
    $fcontents = file_get_contents("$GoogleURL");
    $pagerank = substr($fcontents,9);
    if (!$pagerank) return "0";else return $pagerank;
}
 
$website = $html_url;
$website = str_replace("http://","",$website);
@ $pr = pagerank("$website");
@ date_default_timezone_set(PRC);
$now_date = date("Y年n月j日 G时i分s秒");
?>
 
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>PR查询</title>
</head>
<body>
<?php
echo '<p id="pr_info"><b>'.$html_url.'</b> 的PR为 '.$pr.' <a href="http://upload.chinaz.com//"/></a></p><p><span>查询时间:'.$now_date.'</span></p>';
?>
</body>
</html>

本文地址:http://uicss.cn/bookmark-pr/