You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 48 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Problem with Invision Power Board Stats block (ibf-stats) [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
iforrage
Nuke Cadet
Nuke Cadet


Joined: Dec 13, 2003
Posts: 3


PostPosted: Tue Dec 16, 2003 11:36 am Reply with quoteBack to top

Quote:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site22/fst/var/www/html/phpnuke/blocks/block-Ibf-Stats.php on line 22
You have an error in your SQL syntax near '-_forums.ibf_posts order by pid desc' at line 1
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site22/fst/var/www/html/phpnuke/blocks/block-Ibf-Stats.php on line 30
You have an error in your SQL syntax near '-_forums.ibf_topics WHERE tid=''' at line 1
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site22/fst/var/www/html/phpnuke/blocks/block-Ibf-Stats.php on line 33

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site22/fst/var/www/html/phpnuke/blocks/block-Ibf-Stats.php on line 45


Anyone? Please?
Find all posts by iforrageView user's profileSend private message
Holbrookau
Corporal
Corporal


Joined: May 31, 2003
Posts: 50


PostPosted: Thu Dec 18, 2003 1:33 pm Reply with quoteBack to top

The block is not connecting to your database correctly. ie, 1 or more of the following lines are not right:
Code:
$db_name = "";      // The name of the database where your forums are installed

// Variables
$ibf_stats = "ibf_stats";      // Name of the table where your stats are
$ibf_posts = "ibf_posts";      // The name of your posts table
$ibf_topics = "ibf_topics";      // The name of your topics table
$forum_id = "1";         // The forum ID of the forum you wish to export
$url = "forums/index.php";      // The full URL to your forums
$ibf_sessions = "ibf_sessions"; // Change if not correct
$ibf_groups = "ibf_groups";  // Change if not correct
$linkforums = "http://www.yoursiteurl/forums"; //Your Forum URL


Anyway, the code for this block is old and has some lines that were never used - here is a tidied up version:
Code:
<?
if (eregi("block-Ibf-Stats.php", $PHP_SELF)) {
    Header("Location: index.php");
    die();
}

// Edit these variables to suit your site
$db_name = "";      // Name of your IPB database (if PHP-Nuke & IPB are sharing the same database you can leave it blank).
$ibfprefix = "ibf";  // Prefix of your IPB tables (default = ibf)
$linkforums = "http://www.yoursite/forums"; //Your Forum URL
// End

global $sitename, $db;

$dbpath = "$db_name.$ibfprefix";

$stats_sql = $db->sql_query("select * from ".$dbpath."_stats");
$stats=$db->sql_fetchrow($stats_sql);
$date = date ("jS M Y" ,$stats["MOST_DATE"]);
$posts = $stats["TOTAL_TOPICS"] + $stats["TOTAL_REPLIES"];
$threads = $stats["TOTAL_TOPICS"];

$content = "<font size=\"1\"><a href=\"$linkforums\"><center><b>$sitename Forums</a></b></center><br><b>Posts</b>: $posts<br><b>Threads</b>: $threads<br><b>Members</b>: $stats[MEM_COUNT]</font>";

$last_member_id = $db->sql_query("SELECT * FROM ".$dbpath."_members WHERE name ='$stats[LAST_MEM_NAME]'");
$m=$db->sql_fetchrow($last_member_id);

$content .= "<br><br><font size=\"1\"> Welcome to our newest member, <a href=\"$linkforums/index.php?act=Profile&MID=$m[id]\">$stats[LAST_MEM_NAME]</a><br> Most users ever online was <b>$stats[MOST_COUNT]</b> on $date.</font>";

$lastpost_sql = $db->sql_query("select * from ".$dbpath."_posts order by pid desc");
$p=$db->sql_fetchrow($lastpost_sql);
$last_topic = $db->sql_query("SELECT * FROM ".$dbpath."_topics WHERE tid='$p[topic_id]'");
$t=$db->sql_fetchrow($last_topic);

$content .= "<br><br><b>Last Post</b><br><font size=\"1\">In: <a href=\"$linkforums/index.php?act=ST&f=$p[forum_id]&t=$p[topic_id]\">$t[title]</a><br>By: <a href=\"$linkforums/index.php?act=Profile&MID=$p[author_id]\">$p[author_name]</a></font>";

$time = time() - 900;
$data = $db->sql_query("SELECT s.member_id, s.member_name, s.login_type, g.suffix, g.prefix FROM ".$dbpath."_sessions s, ".$dbpath."_groups g WHERE running_time > '$time' AND g.g_id=s.member_group ORDER BY running_time DESC");
$active['GUESTS'] = 0;
$cached = array();
while ($result = $db->sql_fetchrow($data) )
{
if ($result['member_id'] == 0)
{
$active['GUESTS']++;
}
else
{
if (empty( $cached[ $result['member_id'] ] ) )
{
$cached[ $result['member_id'] ] = 1;
if ($result['login_type'] == 1)
{
                           $active['ANON']++;
}
else
{
                           $active['MEMBERS']++;
                           $active['NAMES'] .= "» <span id='highlight'> </span>&nbsp;<a href='$linkforums/index.php?act=Profile&MID={$result['member_id']}'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a><br> ";
                       }
                   }
                   
               }
           }
           
           $active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
                       
           $content .= "<br><br><b><a href='$linkforums/index.php?act=Online&CODE=listall'>Users online</a></b><br><font color='red'> $active[TOTAL] </font> Members <br>";
         $content .= "<font color='red'> $active[GUESTS] </font> Guests <br>";
           $content .= $active['NAMES'];


?>
Find all posts by HolbrookauView user's profileSend private messageVisit poster's website
iforrage
Nuke Cadet
Nuke Cadet


Joined: Dec 13, 2003
Posts: 3


PostPosted: Thu Dec 18, 2003 9:26 pm Reply with quoteBack to top

Hey, man, thanks for the reply. There seems to be no problem with the code now, i have no errors. But, there are no stats showing up. Might there have to be a NEW post before it starts tracking it?
Find all posts by iforrageView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
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, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.170 Seconds - 184 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::