Autore Messaggio
07-08-2007, 19:23
Messaggio: #1 (permalink)
L'avatar di izzyweb izzyweb
Forumista Attivo
****
Registrato: Apr 2007
Messaggi: 357
Reputazione:

RE: [NamaPR] Get Pagerank!


Ho fatto io la modifica.....
Ho aggiunto le immagini della barretta verde,
ho fatto alcune prove e dovrebbe funzionare sia su linux che su windows
Vedi se ti Gusta
Ciauz

Codice PHP:
<?php
/**
 * Project: NamaPR
 * Version: 1.0
 ***********************************************************************
 * Copyright (C) 1981-2007 Namaless ( http://www.namaless.com/ )
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 ***********************************************************************
 *
 * @link http://www.namaless.com/
 * @copyright 1981-2007 Namaless ( http://www.namaless.com/ )
 *
*/

define ('GOOGLE_MAGIC'0xE6359A60);

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 
_xor32($a$b)
{
 return 
_int32($a) ^ _int32($b);
}

function 
_int32($x)
{
 return 
unserialize("i:$x;");
}

function 
_mix($a$b$c)
{
 
$a -= $b$a -= $c$a _xor32($a_zeroFill($c13));
 
$b -= $c$b -= $a$b _xor32($b$a<<8);
 
$c -= $a$c -= $b$c _xor32($c_zeroFill($b13));
 
$a -= $b$a -= $c$a _xor32($a_zeroFill($c12));
 
$b -= $c$b -= $a$b _xor32($b$a<<16);
 
$c -= $a$c -= $b$c _xor32($c_zeroFill($b5));
 
$a -= $b$a -= $c$a _xor32($a_zeroFill($c3));
 
$b -= $c$b -= $a$b _xor32($b$a<<10);
 
$c -= $a$c -= $b$c _xor32($c_zeroFill($b15));

 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 
$c+=($url[$k+8]<<8);
 case 
$b+=($url[$k+7]<<24);
 case 
$b+=($url[$k+6]<<16);
 case 
$b+=($url[$k+5]<<8);
 case 
$b+=($url[$k+4]);
 case 
$a+=($url[$k+3]<<24);
 case 
$a+=($url[$k+2]<<16);
 case 
$a+=($url[$k+1]<<8);
 case 
$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 
NamaPR($url)
{
 
$ch "6" _GoogleCH(_strord("info:" $url));

 
$pagerank = -1;
 
$fp = @fsockopen("www.google.com"80$errno$errstr10);

 if (!
$fp)
 {
 echo 
"$errstr ($errno)<br />\n";
 }
 else
 {
 
$out "GET /search?client=navclient-auto&ch=" $ch "&features=Rank&q=info:" $url " HTTP/1.1\r\n" ;
 
$out .= "Host: www.google.com\r\n" ;
 
$out .= "Connection: Close\r\n\r\n" ;
 @
fwrite($fp$out);

 while (!
feof($fp))
 {
 
$data = @fgets($fp128);
 
$pos strpos($data"Rank_");

 if (
$pos !== FALSE)
 {
 
$pagerank trim(substr($data$pos 9));
 }
 }

 @
fclose ($fp);
 }
    
//display pagerank image. Create your own or download images I made for this script.
//If you make your own make sure to call them pr0.gif, pr1.gif, pr2.gif etc.
 
 
if($pagerank == 0){
 echo 
"<img src=\"/images/pagerank0.gif\" alt=\"PageRank\">";
 }elseif(
$pagerank == 1){
 echo 
"<img src=\"/images/pagerank1.gif\" alt=\"PageRank\">" ;
 }elseif(
$pagerank == 2){
 echo 
"<img src=\"/images/pagerank2.gif\" alt=\"PageRank\">" ;
 }elseif(
$pagerank == 3){
 echo 
"<img src=\"/images/pagerank3.gif\" alt=\"PageRank\">" ;
 }elseif(
$pagerank == 4){
 echo 
"<img src=\"/images/pagerank4.gif\" alt=\"PageRank\">" ;
 }elseif(
$pagerank == 5){
 echo 
"<img src=\"/images/pagerank5.gif\" alt=\"PageRank\">" ;
 }elseif(
$pagerank == 6){
 echo 
"<img src=\"/images/pagerank6.gif\" alt=\"PageRank\">" ;
 }elseif(
$pagerank == 7){
 echo 
"<img src=\"/images/pagerank7.gif\" alt=\"PageRank\">" ;
 }elseif(
$pagerank == 8){
 echo 
"<img src=\"/images/pagerank8.gif\" alt=\"PageRank\">" ;
 }elseif(
$pagerank == 9){
 echo 
"<img src=\"/images/pagerank9.gif\" alt=\"PageRank\">" ;
 }else{
 echo 
"<img src=\"/images/pagerank10.gif\" alt=\"PageRank\">" ;
 }
 
 
}
?>

Namaless: ho modificato il tag code passandolo a php cosi dovrebbe rimanere piu comprensibile.


Ultima modifica di Namaless : 08-08-2007 alle ore 10:37.

Visita sito dell'autore trova tutti i messaggi dell'autore Quota questo messaggio nella risposta