2013-11-15 12:27:08  來源: PHP編程

< ?php

// Edit this to your website url:
\$myWebSite =
;

define(GMAG xEA);

//unsigned shift right
function zeroFill(\$a \$b) {
\$z = hexdec();

if (\$z & \$a) {
\$a = (\$a>>);
\$a &= (~\$z);
\$a |= x;
\$a = (\$a>>(\$b));
} else {
\$a = (\$a>>\$b);
}

return \$a;
}

function mix(\$a\$b\$c) {

\$a = \$b; \$a = \$c; \$a ^= (zeroFill(\$c));
\$b = \$c; \$b = \$a; \$b ^= (\$a< &lt;);
\$c = \$a; \$c = \$b; \$c ^= (zeroFill(\$b));
\$a = \$b; \$a = \$c; \$a ^= (zeroFill(\$c));
\$b = \$c; \$b = \$a; \$b ^= (\$a<&lt;);
\$c = \$a; \$c = \$b; \$c ^= (zeroFill(\$b));
\$a = \$b; \$a = \$c; \$a ^= (zeroFill(\$c));
\$b = \$c; \$b = \$a; \$b ^= (\$a<&lt;);
\$c = \$a; \$c = \$b; \$c ^= (zeroFill(\$b));

return array(\$a\$b\$c);
}

function GCH(\$url \$length=null \$init=GMAG) {

if(is_null(\$length)) {
\$length = sizeof(\$url);
}

\$a = \$b = xEB;
\$c = \$init;
\$k = ;
\$len = \$length;

while(\$len >= ) {
\$a += (\$url[\$k+] +(\$url[\$k+]< &lt;) +(\$url[\$k+]<&lt;) +(\$url[\$k+]<&lt;));
\$b += (\$url[\$k+] +(\$url[\$k+]<&lt;) +(\$url[\$k+]<&lt;) +(\$url[\$k+]<&lt;));
\$c += (\$url[\$k+] +(\$url[\$k+]<&lt;) +(\$url[\$k+]<&lt;)+(\$url[\$k+]<&lt;));
\$mix = mix(\$a\$b\$c);
\$a = \$mix[]; \$b = \$mix[]; \$c = \$mix[];
\$k += ;
\$len = ;
}

\$c += \$length;

switch(\$len) {/* all the case statements fall through */
case : \$c+=(\$url[\$k+]<&lt;);
case : \$c+=(\$url[\$k+]<&lt;);
case : \$c+=(\$url[\$k+]<&lt;);
/* the first byte of c is reserved for the length */
case : \$b+=(\$url[\$k+]<&lt;);
case : \$b+=(\$url[\$k+]<&lt;);
case : \$b+=(\$url[\$k+]<&lt;);
case : \$b+=(\$url[\$k+]);
case : \$a+=(\$url[\$k+]<&lt;);
case : \$a+=(\$url[\$k+]<&lt;);
case : \$a+=(\$url[\$k+]<&lt;);
case : \$a+=(\$url[\$k+]);
/* case : nothing left to add */
}

\$mix = mix(\$a\$b\$c);
/* report the result */
return \$mix[];
}

//converts a string into an array of integers containing the numeric value of the char
function strord(\$string) {

for(\$i=;\$i<strlen(\$string);\$i++) {
\$result[\$i] = ord(\$string{\$i});
}

return \$result;
}

function getPR(\$_url) {

\$url = info:\$_url;
\$ch = GCH(strord(\$url));
\$url=info:urlencode(\$_url);
\$pr = file("\$ch&ie=UTF&oe=UTF&features=Rank&q=\$url");
\$pr_str = implode("" \$pr);

return substr(\$pr_strstrrpos(\$pr_str ":")+);
}

echo "<br>The PR of \$myWebsite is: "getPR(\$myWebSite);
?>

From:http://tw.wingwit.com/Article/program/PHP/201311/20977.html
推薦文章