SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation URGENT: Script works on one server but not another!!!

    Ok this PageRank checking script works fine here:

    http://betaload.com/checkmypr/

    but the same script copied and pasted into a different server here:

    http://www.hereafterhav0k.com/checkmypr/

    The PageRank checking script does not seem to work and shows up with a negative 1 PR for all websites whilest the other one works as intended. The first server is running Direct Admin and the second is running C-Panel. I know for a fact the problem is no in the script itself but in the servers. If anyone has any idea on why this may be happening please post any hunches this is very urgent and I need to try and get it solved ASAP!

    Thanks!

  2. #2
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It could be a register_globals problem, though it is hard to trouble shoot without any code what so ever.

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is an opensource script so here it is: also It is'nt a big script and im almost certain it isnt the script it self.

    PHP Code:
    <?PHP

    if (!$_REQUEST)
    {
        echo 
    "<p>Your stats will appear here</p>";
    }

    $website $_REQUEST['url'];
    if( 
    $website ){
        if( !
    strstr($website,"http://") && !strstr($website,"https://") ){
            
    $website "http://".$website;
        }
        
    $linkedpages linkcheck($website,'google');
        
    $indexedpages GoogleLinks($website);

        
    $pr GooglePageRank($website);
        
    $indexed $indexedpages[google][0];
        
    $links $linkedpages[google][0];


    ?>
        <table width='300' border='0' cellpadding='4' cellspacing='0'>
            <tr>
                <td align='left' colspan='2'><b>Retrieving info for <?=$website?>...</b></td>
            </tr>
            <tr>
                <td><strong>Website</strong></td><td><a href="<?=$website?>"><?=$website?></a></td>
            </tr>
            <tr>
                <td><strong>Page Rank</strong></td><td><?=$pr?> / 10</td>
            </tr>
            <tr>
                <td><strong>Indexed Pages</strong></td><td><a href="<?=$indexedpages[google][1]?>"><?=$indexed?></a></td>
            </tr>
            <tr>
                <td><strong>BackLinks</strong></td><td><a href="<?=$linkedpages[google][1]?>"><?=$links?></a></td>
            </tr>
        </table>

    </center>
    <?
    }



    function 
    linkcheck($url$engine) {
        global 
    $total;
        
    $arr parse_url($url);
        
    $url $arr['host'];
        
    $path "http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=link%3A".$url;
        if(!
    file_exists($path)) {
            
    $data strtolower(strip_tags(implode(""file($path))));
            
    $data substr($datastrpos($data"of about")+9strlen($data));
            
    $data substr($data0strpos($data" "));
            if(
    eregi("[[:alpha:]]"$data)) {
                
    $results[$engine] = array('0'$path);
            } else {
                
    $results[$engine] = array($data$path);
                
    $total+=str_replace(','''$data);
            }
        } else {
            
    $results[$engine] = array('n/a'$path);
        }
        return 
    $results;
    }
    function 
    GoogleLinks($url){
        
    $arr parse_url($url);
        
    $url $arr['host'];
        
    $engine 'google';
        
    $path 'http://www.google.com/search?q=inurl:'.$url.'&hl=en&lr=&ie=UTF-8&filter=0';
        if(!
    file_exists($path)) {
            
    $data str_replace('&nbsp;'' 'strtolower(strip_tags(@implode('', @file($path)))));
            if(!
    strpos($data'did not match any documents')) {
                
    $data substr($datastrpos($data'web results')+12strlen($data));
                
    $data trim(substr($data0strpos($data'for'))); // echo $data; // TEST
                
    $data explode(' '$data);
                
    $data $data[(count($data)-1)];
                
    $results[$engine] = array($data$path);
                
    $total+=str_replace(','''$data);
            } else {
                
    $results[$engine] = array('0'$path);
            }
        } else {
            
    $results[$engine] = array('n/a'$path);
        }
        return 
    $results;
    }

    function 
    GooglePageRank($url){
        
    $arr parse_url($url);
        
    $url $arr['host'];
        
    $url="info:".$url$ch=GoogleCSum($url,0xE6359A60);
        
    $host="toolbarqueries.google.com"$hostip=gethostbyname($host);
        
    $query ="GET /search?client=navclient-auto&ch=6".$ch."&ie=UTF-8&oe=UTF-8&features=Rank&q=".rawurlencode($url)." HTTP/1.0\r\n";
        
    $query.="Host: $host\r\n"$rank=-1;
        
    $query.="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n";
        
    $query.="Connection: Close\r\n\r\n";
        
    $fp=fsockopen($hostip,80,$errno,$errstr,30);
        if (
    $fp)
        { 
    fputs($fp,$query); $data=""; while (!feof($fp)) $data.=fgets($fp,4096); fclose($fp);
        
    $data=explode("\n",$data);
        foreach (
    $data as $line)
        if (!
    is_bool(strpos($line,"Rank_1")))
        { 
    $rank=explode(":",trim($line)); $rank=$rank[2]; break; } }
        return 
    $rank;
    }

    function 
    GoogleCSum($s,$key){
        
    $v4=$len=strlen($s); $esi=$key$ebx=$edi=0x9E3779B9$p=0;
        if (
    $len>=12)
        for(
    $i=0;$i<floor($len/12);$i++)
        { 
    $edi=unsign($edi+ord($s[$p+4])+(ord($s[$p+5]) << 8)+(ord($s[$p+6]) << 16)+(ord($s[$p+7]) << 24));
        
    $esi=unsign($esi+ord($s[$p+8])+(ord($s[$p+9]) << 8)+(ord($s[$p+10]) << 16)+(ord($s[$p+11]) << 24));
        
    $edx=unsign(($ebx+ord($s[$p+0])+(ord($s[$p+1]) << 8)+(ord($s[$p+2]) << 16)+(ord($s[$p+3]) << 24)-$edi-$esi)^shr($esi,13));
        
    $edi=unsign(($edi-$esi-$edx)^($edx << 8));
        
    $esi=unsign(($esi-$edx-$edi)^shr($edi,13));
        
    $edx=unsign(($edx-$edi-$esi)^shr($esi,12));
        
    $edi=unsign(($edi-$esi-$edx)^($edx << 16));
        
    $esi=unsign(($esi-$edx-$edi)^shr($edi,5));
        
    $edx=unsign(($edx-$edi-$esi)^shr($esi,3)); $ebx=$edx;
        
    $edi=unsign(($edi-$esi-$ebx)^($ebx << 10));
        
    $esi=unsign(($esi-$ebx-$edi)^shr($edi,15));
        
    $v4-=12$p+=12; }
        
    $esi=unsign($esi+$len);
        if (
    $v4>=11$esi=unsign($esi+(ord($s[$p+10]) << 24));
        if (
    $v4>=10$esi=unsign($esi+(ord($s[$p+9]) << 16));
        if (
    $v4>=9$esi=unsign($esi+(ord($s[$p+8]) << 8));
        if (
    $v4>=8$edi=unsign($edi+ord($s[$p+4])+(ord($s[$p+5]) << 8)+(ord($s[$p+6]) << 16)+(ord($s[$p+7]) << 24));
        else
        { if (
    $v4>=7$edi=unsign($edi+(ord($s[$p+6]) << 16));
        if (
    $v4>=6$edi=unsign($edi+(ord($s[$p+5]) << 8));
        if (
    $v4>=5$edi=unsign($edi+ord($s[$p+4])); }
        if (
    $v4>=4$ebx=unsign($ebx+ord($s[$p+0])+(ord($s[$p+1]) << 8)+(ord($s[$p+2]) << 16)+(ord($s[$p+3]) << 24));
        else
        { if (
    $v4>=3$ebx=unsign($ebx+(ord($s[$p+2]) << 16));
        if (
    $v4>=2$ebx=unsign($ebx+(ord($s[$p+1]) << 8));
        if (
    $v4>=1$ebx=unsign($ebx+ord($s[$p+0])); }
        
    $ebx=unsign(($ebx-$edi-$esi)^shr($esi,13));
        
    $edi=unsign(($edi-$esi-$ebx)^($ebx << 8));
        
    $esi=unsign(($esi-$ebx-$edi)^shr($edi,13));
        
    $ebx=unsign(($ebx-$edi-$esi)^shr($esi,12));
        
    $edi=unsign(($edi-$esi-$ebx)^($ebx << 16));
        
    $esi=unsign(($esi-$ebx-$edi)^shr($edi,5));
        
    $ebx=unsign(($ebx-$edi-$esi)^shr($esi,3));
        
    $edi=unsign(($edi-$esi-$ebx)^($ebx << 10));
        
    $esi=unsign(($esi-$ebx-$edi)^shr($edi,15)); return $esi;
    }
    function 
    shr($x,$y) {
        
    $x=unsign($x);
        for(
    $i=0;$i<$y;$i++) $x=floor($x/2); return $x;
    }
    function 
    unsign($l) {
        
    $l=intval($l);
        if (
    $l>=0){
            return 
    $l;
        }else{
            return 
    4294967296+$l;
        }
    }
    ?>

  4. #4
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PS: I just closed the register_globals problem becuase on my local server the same script works with it on or off. So it just seems to be my websever but I'm not sure what about my webserver it is.

  5. #5
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Plano
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    where are the servers located? are either of them located out of the country?

  6. #6
    Non-Member Gator99's Avatar
    Join Date
    Sep 2004
    Location
    Florida
    Posts
    613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Chances are your new host doesn't allow you to open remote files.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •