Welcome Guest!   Please Login or Register
Subscribe Today

You are not subscriber of DaDaNuke | Making PHP-Nuke Better!. You can subscribe from here now!

Sponsored Links




Search




Site Navigation

· Home
· About Us
· Advertise With Us
· Club
· CVS
· Downloads
· Feedback
· Forums
· Gallery
· Groups
· Journal
· Private Messages
· Search
· Stories Archive
· Submit News
· Top 10
· Topics
· Web Links
· Your Account

Survey

I Want This Addon:

SEO
Gaming
Commerce
Database
Security



Results
Polls

Votes 562

Advertisers





Who's Online

There are currently, 27 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here

Total Hits

We received
3861848
page views since September 2005




DaDaNuke :: View topic - [NEED FIX] Google Rank Not Displaying
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log inLog in 

[NEED FIX] Google Rank Not Displaying

 
Post new topic   Reply to topic    DaDaNuke Forum Index -> PHP-Nuke
View previous topic :: View next topic  
Author Message
dadaBIT
General Manager
General Manager


Joined: Jun 23, 2005
Posts: 582
Location: United States

PostPosted: Sat Jul 22, 2006 10:26 am    Post subject: [NEED FIX] Google Rank Not Displaying Reply with quote

Advertising module does not display Google rank under the site stats function. Server side issue needs client side resolution. I recommend substitute with Alexa code. How is this accomplished?

Here is the stats function, located in /html/modules/Advertising/index.php
Code:


function sitestats() {
    global $module_name, $prefix, $db, $user_prefix, $nukeurl, $sitename;
   $url = $nukeurl;   
    $result = $db->sql_query("SELECT hits FROM ".$prefix."_stats_year WHERE hits!='0'");
    $hits = 0;
    $a = 0;
    while ($row = $db->sql_fetchrow($result)) {
       $hits = $hits+$row['hits'];
       $a++;
    }
    $views_y = $hits/$a;
    $result = $db->sql_query("SELECT hits FROM ".$prefix."_stats_month WHERE hits!='0'");
    $hits = 0;
    $a = 0;
    while ($row = $db->sql_fetchrow($result)) {
       $hits = $hits+$row['hits'];
       $a++;
    }
    $views_m = $hits/$a;
    $result = $db->sql_query("SELECT hits FROM ".$prefix."_stats_date WHERE hits!='0'");
    $hits = 0;
    $a = 0;
    while ($row = $db->sql_fetchrow($result)) {
       $hits = $hits+$row['hits'];
       $a++;
    }
    $views_d = $hits/$a;
   $result = $db->sql_query("SELECT hits FROM ".$prefix."_stats_hour WHERE hits!='0'");
   $hits = 0;
    $a = 0;
    while ($row = $db->sql_fetchrow($result)) {
       $hits = $hits+$row['hits'];
       $a++;
    }
    $views_h = $hits/$a;
    $views_y = round($views_y);
    $views_m = round($views_m);
    $views_d = round($views_d);
    $views_h = round($views_h);
    $row = $db->sql_fetchrow($db->sql_query("SELECT count FROM ".$prefix."_counter WHERE type='total'"));
    $views_t = $row['count'];
   $regusers = $db->sql_numrows($db->sql_query("SELECT user_id FROM ".$user_prefix."_users"));
    include("header.php");
    title("$sitename: "._GENERALSTATS."");
    OpenTable();
    echo ""._HEREARENUMBERS."<br><br><br>"
       ."<li>"._TOTALVIEWS." <b>$views_t</b><br><br>"
       ."<li>"._VIEWSYEAR." <b>$views_y</b><br><br>"
      ."<li>"._VIEWSMONTH." <b>$views_m</b><br><br>"
      ."<li>"._VIEWSDAY." <b>$views_d</b><br><br>"
      ."<li>"._VIEWSHOUR." <b>$views_h</b><br><br>"
      ."<li>"._CURREGUSERS." <b>$regusers</b><br><br>";
   if ($url != "http://--------.---") {
      echo "<li>"._GOOGLERANK." <b>".getrank($url)."</b><br><br>";
   }
    CloseTable();
    themenu();
    include("footer.php");
}



Here is Google calculation function
Code:


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 9 : $c+=($url[$k+8]<<8);
        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 = mix($a,$b,$c);
    return $mix[2];
}



And finally, the get rank function
Code:


function getrank($url) {
   define('GOOGLE_MAGIC', 0xE6359A60);
    $url = 'info:'.$url;
    $ch = GoogleCH(strord($url));
    $file = "http://www.google.com/search?client=navclient-auto&ch=6$ch&features=Rank&q=$url";
    $data = file($file);
    $rankarray = explode (':', $data[2]);
    $rank = $rankarray[2];
    return $rank;
}



This is the team that created the code
Quote:

Google Page Rank Calculation
Copyright 2004 by GoogleCommunity.com


Any input would be apprecited, wishing to put this to rest. Thanks!

-Kev
_________________

Visit the DaDaNuke Wish List


Last edited by dadaBIT on Thu Apr 26, 2007 8:14 pm; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger ICQ Number
White_Devil
Moderator
Moderator


Joined: Jan 15, 2006
Posts: 56
Location: Iowa

PostPosted: Wed Aug 16, 2006 2:33 am    Post subject: Reply with quote

Want the good news or the bad news?

Ok I know why it is happening...
Getting your host to fix the option is not likely.

Anyways. I tested on my local and on a backup server And i got an error on the backup....

I turned on error reporting in the config file... I got this..
# Warning: file() [function.file]: URL file-access is disabled in the server configuration in /usr/home/users/44/whitedevil/www/www.devil-modz.be/modules/Advertising/index.php on line 290

Warning: file(http://www.google.com/search?client=navclient-auto&ch=6-1145864932&features=Rank&q=info:http://devil-modz.be) [function.file]: failed to open stream: no suitable wrapper could be found in /usr/home/users/44/whitedevil/www/www.devil-modz.be/modules/Advertising/index.php on line 290
# This site Google's Page Rank:

This is because of a server spacific option in the php.ini file. Most hosts turn this off to keep from hacking and stuff.

On my local i got the information just fin from google with no problems.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
dadaBIT
General Manager
General Manager


Joined: Jun 23, 2005
Posts: 582
Location: United States

PostPosted: Thu Nov 02, 2006 11:47 pm    Post subject: Reply with quote

I think maybe using the 'Alexa' ranking system instead. Just need to figure out the code 'snippet' for Alexa rank and replace. Any ideas? OR, is it not important enough ya think?

-Kev
_________________

Visit the DaDaNuke Wish List
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger ICQ Number
White_Devil
Moderator
Moderator


Joined: Jan 15, 2006
Posts: 56
Location: Iowa

PostPosted: Fri Nov 03, 2006 2:43 am    Post subject: Reply with quote

I dont know. I do know that if you want to send me an email with the snippet and ill test it on an envoroment. As long as it doesnt need to call and download from a remote site like the google one does we could use it.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    DaDaNuke Forum Index -> PHP-Nuke All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Powered by phpBB © 2001 phpBB Group Version 2.0.6 of PHP-Nuke Port by Tom Nitzschner © 2002 www.toms-home.com
Theme designed by Western Studios



Terms of Use | Privacy Policy © 1996-2007, DaDaNuke

Listed on FeedBurner

PHP-Nuke Copyright © 2006 by Francisco Burzi. This is free software, and you may redistribute it under the GPL.
PHP-Nuke comes with absolutely no warranty, for details, see the license.

Theme Designed by Western Studios