Rispondi 
da windows a linux
Modalitą discussione Modalitą lineare
19-07-2007, 21:34
Messaggio: #1 (permalink)
L'avatar di izzyweb izzyweb
Forumista Attivo
****
Registrato: Apr 2007
Messaggi: 355
Reputazione:

da windows a linux


Rieccomi
dopo il passaggio a server linux non mi funziona lo script sottostate
Sapete da cosa dipende??????

Grazie

Codice:
<?php
define('GOOGLE_MAGIC', 0xE6359A60);
class pageRank{
var $pr;
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 mix($a,$b,$c) {
$a -= $b; $a -= $c; $a ^= ($this->zeroFill($c,13));
$b -= $c; $b -= $a; $b ^= ($a<<8);
$c -= $a; $c -= $b; $c ^= ($this->zeroFill($b,13));
$a -= $b; $a -= $c; $a ^= ($this->zeroFill($c,12));
$b -= $c; $b -= $a; $b ^= ($a<<16);
$c -= $a; $c -= $b; $c ^= ($this->zeroFill($b,5));
$a -= $b; $a -= $c; $a ^= ($this->zeroFill($c,3));
$b -= $c; $b -= $a; $b ^= ($a<<10);
$c -= $a; $c -= $b; $c ^= ($this->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 = $this->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 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]);
}
$mix = $this->mix($a,$b,$c);
/* report the result */
return $mix[2];
}

//converts a string into an array of integers containing the numeric value of the char

function strord($string) {
for($i=0;$i<strlen($string);$i++) {
$result[$i] = ord($string{$i});
}
return $result;
}

function printrank($url){
$ch = "6".$this->GoogleCH($this->strord("info:" . $url));

$fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
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($fp, 128);
$pos = strpos($data, "Rank_");
if($pos === false){
}else{
$pagerank = substr($data, $pos + 9);
$this->pr_image($pagerank);
}
}
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.
function pr_image($pagerank){
if($pagerank == 0){
$this->pr = "document.write('<a href=http://www.izzyweb.it target=_blank><img src=http://www.izzyweb.it/seo-utility/images/pagerank0.gif border=0 alt=Pagerank/></a>')" ;
}elseif($pagerank == 1){
$this->pr = "document.write('<a href=http://www.izzyweb.it target=_blank><img src=http://www.izzyweb.it/seo-utility/images/pagerank1.gif border=0 alt=Pagerank/></a>')" ;
}elseif($pagerank == 2){
$this->pr = "document.write('<a href=http://www.izzyweb.it target=_blank><img src=http://www.izzyweb.it/seo-utility/images/pagerank2.gif border=0 alt=Pagerank/></a>')" ;
}elseif($pagerank == 3){
$this->pr = "document.write('<a href=http://www.izzyweb.it target=_blank><img src=http://www.izzyweb.it/seo-utility/images/pagerank3.gif border=0 alt=Pagerank/></a>')" ;
}elseif($pagerank == 4){
$this->pr = "document.write('<a href=http://www.izzyweb.it target=_blank><img src=http://www.izzyweb.it/seo-utility/images/pagerank4.gif border=0 alt=Pagerank/></a>')" ;
}elseif($pagerank == 5){
$this->pr = "document.write('<a href=http://www.izzyweb.it target=_blank><img src=http://www.izzyweb.it/seo-utility/images/pagerank5.gif border=0 alt=Pagerank/></a>')" ;
}elseif($pagerank == 6){
$this->pr = "document.write('<a href=http://www.izzyweb.it target=_blank><img src=http://www.izzyweb.it/seo-utility/images/pagerank6.gif border=0 alt=Pagerank/></a>')" ;
}elseif($pagerank == 7){
$this->pr = "document.write('<a href=http://www.izzyweb.it target=_blank><img src=http://www.izzyweb.it/seo-utility/images/pagerank7.gif border=0 alt=Pagerank/></a>')" ;
}elseif($pagerank == 8){
$this->pr = "document.write('<a href=http://www.izzyweb.it target=_blank><img src=http://www.izzyweb.it/seo-utility/images/pagerank8.gif border=0 alt=Pagerank/></a>')" ;
}elseif($pagerank == 9){
$this->pr = "document.write('<a href=http://www.izzyweb.it target=_blank><img src=http://www.izzyweb.it/seo-utility/images/pagerank9.gif border=0 alt=Pagerank/></a>')" ;
}else{
$this->pr = "document.write('<a href=http://www.izzyweb.it target=_blank><img src=http://www.izzyweb.it/seo-utility/images/pagerank10.gif border=0 alt=Pagerank/></a>')" ;
}
}
function get_pr(){
return $this->pr;
}
}
?>

Pagina pr-meter.php

Codice:
<?php
if(isset($_GET['url'])){ //pagina passata via parametro
$p=$_GET['url'];
if($p!=basename($p) || !preg_match("/^[A-Za-z0-9\-_]+$/",$p) || $p=="pr-meter" || !file_exists($p.".php"))

$sito = $_GET[url];
include("pagerank.php");
$gpr = new pageRank();
$gpr->printrank("$sito");
//display image
echo $gpr->get_pr();
}
?>


e questo e' lo script per richiamare il tutto:

Codice:
<script src="http://www.izzyweb.it/seo-utility/pr-meter.php?url=www.tuosito.it"></script>


NamaEdit: Si scrive "Linux" gnurant Abbr


Aggregatore di feed

Ultima modifica di Namaless : 26-07-2007 alle ore 12:38.

Visita sito dell'autore trova tutti i messaggi dell'autore Quota questo messaggio nella risposta
20-07-2007, 18:33
Messaggio: #2 (permalink)
Namaless
Forumista Attivo
****
Registrato: Nov 2007
Messaggi: 320
Reputazione:

RE: da windows a linus


mm ma maggiori informazioni?

Non genera niente, nessuno errore? nessun messaggio? ^^

Visita sito dell'autore trova tutti i messaggi dell'autore Quota questo messaggio nella risposta
20-07-2007, 19:36
Messaggio: #3 (permalink)
L'avatar di izzyweb izzyweb
Forumista Attivo
****
Registrato: Apr 2007
Messaggi: 355
Reputazione:

RE: da windows a linus


Su server windows funzionava benissimo
adesso che sono su linus non genera niente
da cosa pui' dipendere?????

Aggregatore di feed

Visita sito dell'autore trova tutti i messaggi dell'autore Quota questo messaggio nella risposta
21-07-2007, 12:45
Messaggio: #4 (permalink)
Namaless
Forumista Attivo
****
Registrato: Nov 2007
Messaggi: 320
Reputazione:

RE: da windows a linus


Non per farti passare da ignorante ma si chiama "Linux" e non "Linus".

Per altro...mmm... sarebbe da fare delle prove.. vedo stasera di fare qualcosa 18

Visita sito dell'autore trova tutti i messaggi dell'autore Quota questo messaggio nella risposta
21-07-2007, 12:50
Messaggio: #5 (permalink)
L'avatar di izzyweb izzyweb
Forumista Attivo
****
Registrato: Apr 2007
Messaggi: 355
Reputazione:

RE: da windows a linus


se mi risolvi questo problema mi faresti un enorme piacere,
Avevo diversi siti che usavano la mia barra del Pagerank,
In cambio ti metto il link in un mio sito
Grazie

Aggregatore di feed

Visita sito dell'autore trova tutti i messaggi dell'autore Quota questo messaggio nella risposta
26-07-2007, 12:43
Messaggio: #6 (permalink)
Namaless
Forumista Attivo
****
Registrato: Nov 2007
Messaggi: 320
Reputazione:

RE: da windows a linux


Codice:
<?php
define('GOOGLE_MAGIC', 0xE6359A60);
class pageRank{
var $pr;
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 mix($a,$b,$c) {
   $a -= $b; $a -= $c; $a ^= ($this->zeroFill($c,13));
   $b -= $c; $b -= $a; $b ^= ($a<<8);
   $c -= $a; $c -= $b; $c ^= ($this->zeroFill($b,13));
   $a -= $b; $a -= $c; $a ^= ($this->zeroFill($c,12));
   $b -= $c; $b -= $a; $b ^= ($a<<16);
   $c -= $a; $c -= $b; $c ^= ($this->zeroFill($b,5));
   $a -= $b; $a -= $c; $a ^= ($this->zeroFill($c,3));
   $b -= $c; $b -= $a; $b ^= ($a<<10);
   $c -= $a; $c -= $b; $c ^= ($this->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 = $this->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 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]);
  }
  $mix = $this->mix($a,$b,$c);
/* report the result */
return $mix[2];
}

//converts a string into an array of integers containing the numeric value of the char

function strord($string) {
  for($i=0;$i<strlen($string);$i++) {
   $result[$i] = ord($string{$i});
  }
return $result;
}

function printrank($url){
  $ch = "6".$this->GoogleCH($this->strord("info:" . $url));
  
  $fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
  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($fp, 128);
       $pos = strpos($data, "Rank_");
         if($pos === false){
         }else{
           $pagerank = substr($data, $pos + 9);
           $this->pr_image($pagerank);
         }
     }
     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.
function pr_image($pagerank){
  if($pagerank == 0){
   $this->pr = "<img src=\"images/pr0.gif\" alt=\"PageRank " .$pagerank. " out of 10\">" ;
   }elseif($pagerank == 1){
   $this->pr = "<img src=\"images/pr1.gif\" alt=\"PageRank " .$pagerank. " out of 10\">" ;
   }elseif($pagerank == 2){
   $this->pr = "<img src=\"images/pr2.gif\" alt=\"PageRank " .$pagerank. " out of 10\">" ;
   }elseif($pagerank == 3){
   $this->pr = "<img src=\"images/pr3.gif\" alt=\"PageRank " .$pagerank. " out of 10\">" ;
   }elseif($pagerank == 4){
   $this->pr = "<img src=\"images/pr4.gif\" alt=\"PageRank " .$pagerank. " out of 10\">" ;
   }elseif($pagerank == 5){
   $this->pr = "<img src=\"images/pr5.gif\" alt=\"PageRank " .$pagerank. " out of 10\">" ;
   }elseif($pagerank == 6){
   $this->pr = "<img src=\"images/pr6.gif\" alt=\"PageRank " .$pagerank. " out of 10\">" ;
   }elseif($pagerank == 7){
   $this->pr = "<img src=\"images/pr7.gif\" alt=\"PageRank " .$pagerank. " out of 10\">" ;
   }elseif($pagerank == 8){
   $this->pr = "<img src=\"images/pr8.gif\" alt=\"PageRank " .$pagerank. " out of 10\">" ;
   }elseif($pagerank == 9){
   $this->pr = "<img src=\"images/pr9.gif\" alt=\"PageRank " .$pagerank. " out of 10\">" ;
   }else{
   $this->pr = "<img src=\"images/pr10.gif\" alt=\"PageRank " .$pagerank. " out of 10\">" ;
  }
}
function get_pr(){
  return $this->pr;
}
}
?>


Codice:
<?php
include("pagerank.php");
$gpr = new pageRank();
$gpr->printrank("http://www.yahoo.com");
//display image
echo $gpr->get_pr();
?>


Prova e fammi sapere io non ho tempo di provare.. ^^


Visita sito dell'autore trova tutti i messaggi dell'autore Quota questo messaggio nella risposta
26-07-2007, 13:38
Messaggio: #7 (permalink)
L'avatar di izzyweb izzyweb
Forumista Attivo
****
Registrato: Apr 2007
Messaggi: 355
Reputazione:

RE: da windows a linux


Ok stasera lo provo e ti dico se cosi funziona
Grazie per l'aiuto

Aggregatore di feed

Visita sito dell'autore trova tutti i messaggi dell'autore Quota questo messaggio nella risposta
27-07-2007, 08:17
Messaggio: #8 (permalink)
Namaless
Forumista Attivo
****
Registrato: Nov 2007
Messaggi: 320
Reputazione:

RE: da windows a linux


See figurati.. mi dai tante info per il seo, se ogni tanto faccio qualcosa in php non mi sconvolge la vita ^^

Visita sito dell'autore trova tutti i messaggi dell'autore Quota questo messaggio nella risposta
28-07-2007, 20:24
Messaggio: #9 (permalink)
L'avatar di izzyweb izzyweb
Forumista Attivo
****
Registrato: Apr 2007
Messaggi: 355
Reputazione:

RE: da windows a linux


Non mi funziona , e non da' nessuno errore
Non ci capisco piu' niente :-(

Aggregatore di feed

Visita sito dell'autore trova tutti i messaggi dell'autore Quota questo messaggio nella risposta
29-07-2007, 11:54
Messaggio: #10 (permalink)
Namaless
Forumista Attivo
****
Registrato: Nov 2007
Messaggi: 320
Reputazione:

RE: da windows a linux


Ho capito, devo trovare il tempo per fare delle prove.. ma di questo periodo sono troppo occupato per poter fare dei test..

Se il tempo non e' un tuo problema, risolveremo anche questo ^^

Visita sito dell'autore trova tutti i messaggi dell'autore Quota questo messaggio nella risposta
29-07-2007, 19:05
Messaggio: #11 (permalink)
L'avatar di izzyweb izzyweb
Forumista Attivo
****
Registrato: Apr 2007
Messaggi: 355
Reputazione:

RE: da windows a linux


non ti preoccupare per il tempo non ho fretta
Grazie per l'aiuto.............

Aggregatore di feed

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

Discussioni simili
Discussione: Autore Risposte: Letto: Ultimo messaggio
  Bug Windows: uso di session_start e UTF-8 Namaless 2 232 01-09-2007 04:43
Ultimo messaggio: Namaless

da windows a linux
Guarda versione stampabile
Invia la discussione a un amico
Sottoscrivi la discussione
Aggiungi discussione alle favorite

Regole di Scrittura
Tu non puoi inserire nuovi messaggi.
Tu non puoi rispondere ai messaggi.
Tu non puoi inviare messaggi.
Tu non puoi modificare i tuoi messaggi.
Il codice HTML č Disattivato.
Il codice MyCode č Attivato.
Gli Smilies sono Attivato.
Il codice [IMG] Attivato.
Vai al Forum:

Data e Ora attuale: 11-10-2008, 15:05

Contattaci - Punto Web