boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Hacks] B2 Stats
Goto page Previous  1, 2, 3 ... 9, 10, 11
 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
epolady



Joined: 30 Jul 2002
Posts: 800
Location: Texas

PostPosted: Fri Oct 03, 2003 7:54 am    Post subject: Reply with quote

Viper007Bond wrote:
Do you have a link to the demo?

http://gamerz.pixel-junkies.net/b2stats.php
I have this on my site as well.
_________________
No more support from me. Goodbye!
Go upgrade to WordPress, you'll find better support there.
Back to top
View user's profile Send private message
Viper007Bond



Joined: 15 Aug 2003
Posts: 266
Location: Portland, Oregon, USA

PostPosted: Sat Oct 04, 2003 4:44 am    Post subject: Reply with quote

epolady wrote:
Viper007Bond wrote:
Do you have a link to the demo?

http://gamerz.pixel-junkies.net/b2stats.php
I have this on my site as well.

Ah, thanks. Very Happy

I like it and I'm customizing it now. I'll post my results when I get done. Smile

*UPDATE*

Alright, here is my stats page.

However, I have run across an error in the code. The "Next Page" link does not appear on the second to last page due to a "+1" being in there.

Example page

Here is the fix:

On line 183:
Code:
if($page >= 1 && ((($page*$limit)+1) < $numrows))

Replace with:
Code:
if($page >= 1 && ((($page*$limit)) < $numrows))

Result of code change
_________________
http://www.viper007bond.com

If you haven't already installed b2, I advise you look into WordPress or b2evo instead as b2 is dead.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Viper007Bond



Joined: 15 Aug 2003
Posts: 266
Location: Portland, Oregon, USA

PostPosted: Sun Oct 12, 2003 9:23 am    Post subject: Reply with quote

Hmm, working now. Seems to only occur when there is just one more than X pages worth.
_________________
http://www.viper007bond.com

If you haven't already installed b2, I advise you look into WordPress or b2evo instead as b2 is dead.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Cine



Joined: 22 Sep 2002
Posts: 22
Location: Lost

PostPosted: Sun Oct 12, 2003 2:08 pm    Post subject: Reply with quote

Very nice hack! <3

Here's my stats page, I edited it pretty much so it could match my priorities.
http://www.aozora.nu/blog/b2stats.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Viper007Bond



Joined: 15 Aug 2003
Posts: 266
Location: Portland, Oregon, USA

PostPosted: Mon Oct 13, 2003 12:53 am    Post subject: Reply with quote

I've edited mine to display the times of the posts/comments which I bet many people may like. I think I'll release the changed code when I release my modified version of the refferrer hack.
_________________
http://www.viper007bond.com

If you haven't already installed b2, I advise you look into WordPress or b2evo instead as b2 is dead.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
KinkieKitty



Joined: 12 Apr 2003
Posts: 2
Location: New York

PostPosted: Mon Nov 17, 2003 2:57 am    Post subject: Reply with quote

In my b2stats page I get the following message for the referrers:

Referers Stats

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/dorkifie/public_html/refererLib.php on line 103

Lines 99-110 are the following:

Quote:
else {
$sqr_recentReferer = mysql_query("select Count(referer_visitLog.baseDomain) as totalHits, referer_visitLog.baseDomain from referer_visitLog where visitURL = '$visitURL' group by referer_visitLog.baseDomain order by totalHits desc limit $howMany");
}

while($result_row = mysql_fetch_array($sqr_recentReferer)){

$count = $result_row['totalHits'];
$domain = $result_row['baseDomain'];

$uSet = mysql_query("select * from referer_visitLog where baseDomain = '$domain' order by visitID desc");
$uRow = mysql_fetch_array($uSet);
$latestUrl = $uRow["referingURL"];


Anyone know what could be happening? Thanks!
Back to top
View user's profile Send private message Visit poster's website
PDdotORG



Joined: 16 Jan 2004
Posts: 6
Location: Camp Pendleton, CA

PostPosted: Thu Jan 29, 2004 3:37 pm    Post subject: Reply with quote

I got b2 stats running fine and have customized it to my liking. But, I can't figure out why the top 10 commenters are not linked. I have read through this entire thread numerous times and thought I would have had it. Please, tell me what I'm missing.
Code:
<?php

/* Begin b2stats.php hack
By GamerZ with modifications from dotdotspace
Contact:
GamerZ: http://www.gamerz.per.sg
dotdotspace: http://www.dotdotspace.net

You must leave this info line in the file if you modify it.
*/


// Start Connect To MYSQL
include ("blog.header.php");
include("refererLib.php");
dbconnect();

// Check $user isset
if(!isset($user) || $user == "") {

// Basic MYSQL Queries
$a = mysql_query("SELECT COUNT(DISTINCT ID) FROM $tableposts") or die(mysql_error());
$totalposts = mysql_result($a, 0);

$b = mysql_query("SELECT COUNT(DISTINCT comment_ID) FROM $tablecomments") or die(mysql_error());
$totalcomments = mysql_result($b, 0);

$c = mysql_query("SELECT COUNT(DISTINCT comment_author) FROM $tablecomments") or die(mysql_error());
$commentsposters = mysql_result($c, 0);
echo "<b>b2 STATISTICS...</b><br>\n";

// Output General Stats
echo "<br><br>";
echo "<div class=\"Title\"><b>» Generals Stats</b></div>\n";
echo "<b>".$totalposts."</b> Posts<br>\n";
echo "<b>".$totalcomments."</b> Comments<br>\n";
echo "<b>".$commentsposters."</b> Different Commenters<br>\n";

// Latest 10 Blog Entries
echo "<br><br><div class=\"Title\"><b>» Latest 10 Blog Entries</b></div>\n";
$query = "SELECT ID, post_title FROM b2posts ORDER BY post_date DESC LIMIT 10";
$result = mysql_query($query);
while ($data = mysql_fetch_row($result)) {
$data[1] = stripslashes($data[1]);
echo "<b>+</b> <a href=\"http://passionate-desire.org/index.php?p=$data[0]\">$data[1]</a><br>\n";
}

// Latest 10 Comments
echo "<br><br><div class=\"Title\"><b>» Latest 10 Comments</b></div>\n";
$query = "SELECT ID, post_title, comment_author, comment_date FROM b2posts, b2comments WHERE b2posts.ID=b2comments.comment_post_ID ORDER BY b2comments.comment_date DESC LIMIT 10";
$result = mysql_query($query);
while ($data = mysql_fetch_row($result)) {
$data[1] = stripslashes($data[1]);
echo "<b>+</b> $data[3] - $data[2] (<a href=\"http://passionate-desire.org/index.php?p=$data[0]\">$data[1]</a>)<br>\n";
}

// Top 10 Most Commented Blogs
echo "<br><br><div class=\"Title\"><b>» 10 Most Commented Entries</b></div>\n";
$query = "SELECT ID, post_title, COUNT(b2comments.comment_post_ID) AS 'commentstotal' FROM b2posts , b2comments WHERE b2posts.ID=b2comments.comment_post_ID GROUP BY b2comments.comment_post_ID ORDER BY commentstotal DESC LIMIT 10";
$result = mysql_query($query);
while ($data = mysql_fetch_row($result)) {
$data[1] = stripslashes($data[1]);
echo "<b>+</b> <a href=\"http://passionate-desire.org/index.php?p=$data[0]\">$data[1]</a> ($data[2] Comments)<br>\n";
}

// Top 20 Commenters
echo "<br><br><div class=\"Title\"><b>» Top 20 Commenters</b></div>\n";
$e = mysql_query("SELECT comment_author, COUNT(*) AS 'total' FROM b2comments GROUP BY comment_author ORDER BY total DESC LIMIT 20") or die(mysql_error());
$i=1;
while ($data = mysql_fetch_row($e)) {
echo "<b>+</b> ".$data[0]." (".$data[1].")<br>\n"; // holds the number of comments
$i++;
}


// End b2stats.php hack
}
?>
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Ambiguous7286



Joined: 06 Feb 2004
Posts: 3

PostPosted: Fri Feb 06, 2004 8:18 am    Post subject: Hmm Reply with quote

Hmm, b2stats is working but how do I limit the commenter stats to just the top 5? I'm not sure how to change the script around, I'm playing around with it though lol

Ok forget that I figured it out Smile cool, great hack. I'll have to play with this referrer thing as well...
Back to top
View user's profile Send private message AIM Address
sharmaine



Joined: 27 Oct 2003
Posts: 27

PostPosted: Wed Feb 11, 2004 2:08 am    Post subject: Reply with quote

Im sorry to sound dumb but there is no b2stats.php file in my b2 directory. Do i have to create this file?

Thanks.
Back to top
View user's profile Send private message
Ami666



Joined: 11 Feb 2004
Posts: 2

PostPosted: Wed Feb 11, 2004 7:29 pm    Post subject: Reply with quote

Hi!

I've just installed b2stats.php, but when I open the link, I see this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /srv/www/htdocs/crucio_yell/b2/refererLib.php on line 103

What's wrong?

Bye,
Ami666
Back to top
View user's profile Send private message
GamerZ



Joined: 15 May 2002
Posts: 537
Location: Singapore

PostPosted: Thu Apr 08, 2004 6:20 pm    Post subject: Reply with quote

Hi All, Please upgrade from b2 to WordPress(http://www.wordpress.org). There is a wp-stats.php also which is also created by me.

My new site URL is http://www.lesterchan.net
_________________

++ GamerZ.Per.Sg - Complex Simplicity
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
xtheunderdog



Joined: 15 Jun 2004
Posts: 10

PostPosted: Sun Oct 24, 2004 1:56 am    Post subject: Reply with quote

I've got the stats hack working fine, but I've spent the last few days trying to figure out how to put in the Top Five Posters and the number of posts they have (like the commenters one); however, I cannot for the life of me figure out how to do it. I copied and pasted the query for the commenters and edited for authors and did the same with the output, but it doesn't work.

this is what i tried:
Code:
$tp  = "SELECT the_author, COUNT(*) AS 'total' FROM $tableposts GROUP BY the_author ORDER BY total DESC LIMIT 5";


and

Code:
// Top 5 Posters
echo "<b>» Top 5 Posters</b><br>\n";
echo "<table border=\"1\" width=\"20%\" cellspacing=\"2\" cellpadding=\"0\">\n";
echo "<tr>\n";
echo "<td><b>No.</b></td>\n";
echo "<td><b>Members' Nickname</b></td>\n";
echo "<td><b>Members' Posts</b></td>\n";
echo "</tr>\n";

// Top 5 Posters - MYSQL
$e = mysql_query($tp) or die(mysql_error());
$i=1;
while ($data = mysql_fetch_row($e)) {
   echo "<tr>\n<td>".$i."</td>\n";
   echo "<td><a href=\"$siteurl/b2stats.php?user=".$data[0]."\">".$data[0]."</a></td>\n"; // holds the name
   echo "<td>".$data[1]."</td>\n</tr>\n"; // holds the number of comments
   $i++;
}
echo "</table>\n";
echo "</td>\n</tr>\n</table><br><br>";


what am i missing?
Back to top
View user's profile Send private message
Dayna



Joined: 10 Nov 2004
Posts: 4

PostPosted: Wed Nov 17, 2004 2:45 pm    Post subject: Reply with quote

hi.. i need some help here.. my stats page does not work after I've include my layout... anyone know why? I'm pretty new to using b2... thanks if you could help...

i use <? include('header.php'); ?> and <? include('bottom.txt'); ?> to include my layout...

but its not working..

it gives me this error..

Fatal error: Cannot redeclare get_currentuserinfo() (previously declared in /home/icyerz/public_html/confession/b2-include/b2functions.php:21) in /home/icyerz/public_html/confession/b2-include/b2functions.php on line 20
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Goto page Previous  1, 2, 3 ... 9, 10, 11
Page 11 of 11

 
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 2 © 2001, 2002 phpBB Group