View previous topic :: View next topic |
Author |
Message |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Fri Aug 16, 2002 5:43 pm Post subject: [Hacks] B2 Stats |
|
|
Due to many minor errors, I have updated the b2stats.php, now just download it @ http://www.orientek.net/kore/gamerz/files/b2stats.zip
You should not change anything except the layout. The tables names has been intergrated to b2, so you do not need to change it like last time.
The demo of b2stats.php is http://www.orientek.net/kore/gamerz/b2stats2.php
Thanks =) _________________
++ GamerZ.Per.Sg - Complex Simplicity
Last edited by GamerZ on Sun Jan 05, 2003 4:41 pm; edited 6 times in total |
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
|
Back to top |
|
 |
seeya
Joined: 13 Jul 2002 Posts: 32 Location: Singapore
|
Posted: Sat Aug 17, 2002 12:20 am Post subject: |
|
|
seems nice .. but i don't use as i cannot access my ftp .. argh !!!! |
|
Back to top |
|
 |
zootsuit
Joined: 17 May 2002 Posts: 14
|
Posted: Mon Aug 19, 2002 2:34 am Post subject: |
|
|
very nice |
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Mon Aug 19, 2002 5:12 am Post subject: |
|
|
hehe added in some more startts updating the code when i get home _________________
++ GamerZ.Per.Sg - Complex Simplicity |
|
Back to top |
|
 |
seeya
Joined: 13 Jul 2002 Posts: 32 Location: Singapore
|
Posted: Mon Aug 19, 2002 7:38 am Post subject: |
|
|
gamerz then pro  |
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Tue Aug 20, 2002 4:46 pm Post subject: Updated |
|
|
Updated It.
[php:1:de031565ae]
<?
// Start Connect To MYSQL
include ("blog.header.php");
include("refererLib.php");
dbconnect();
// Basic MYSQL Queries
$a = mysql_query('SELECT COUNT(DISTINCT ID) FROM gamerz_b2posts') or die(mysql_error());
$totalposts = mysql_result($a, 0);
$b = mysql_query('SELECT COUNT(DISTINCT comment_ID) FROM gamerz_b2comments') or die(mysql_error());
$totalcomments = mysql_result($b, 0);
$c = mysql_query('SELECT COUNT(DISTINCT comment_author) FROM gamerz_b2comments') or die(mysql_error());
$commentsposters = mysql_result($c, 0);
// Output General Stats
echo "<div class=\"Title\">» Generals Stats</div>\n";
echo "<b>".$totalposts."</b> Posts<br>\n";
echo "<b>".$totalcomments."</b> Comments<br>\n";
echo "<b>".$commentsposters."</b> Different Nicks Were Represented In The Comments\n";
echo "<br><br>";
// Latest 5 Blog Entries
echo "<br><br><div class=\"Title\">» Latest 5 Blog Entries</div>\n";
$query = "SELECT ID, post_title FROM gamerz_b2posts ORDER BY post_date DESC LIMIT 5";
$result = mysql_query($query);
while ($data = mysql_fetch_row($result)) {
echo "<b>+</b> <a href=\"http://www.orientek.net/kore/gamerz/index.php?p=$data[0]\">$data[1]</a><br>\n";
}
// Latest 5 Comments
echo "<br><br><div class=\"Title\">» Latest 5 Comments</div>\n";
$query = "SELECT ID, post_title, comment_author, comment_date FROM gamerz_b2posts, gamerz_b2comments WHERE gamerz_b2posts.ID=gamerz_b2comments.comment_post_ID ORDER BY gamerz_b2comments.comment_date DESC LIMIT 5";
$result = mysql_query($query);
while ($data = mysql_fetch_row($result)) {
echo "<b>+</b> $data[3] - $data[2] (<a href=\"http://www.orientek.net/kore/gamerz/index.php?p=$data[0]\">$data[1]</a>)<br>\n";
}
// Top 5 Most Commented Blog
echo "<br><br><div class=\"Title\">» 5 Most Commented Blogs</div>\n";
$query = "SELECT ID, post_title, COUNT(gamerz_b2comments.comment_post_ID) AS 'commentstotal' FROM gamerz_b2posts , gamerz_b2comments WHERE gamerz_b2posts.ID=gamerz_b2comments.comment_post_ID GROUP BY gamerz_b2comments.comment_post_ID ORDER BY commentstotal DESC LIMIT 5";
$result = mysql_query($query);
while ($data = mysql_fetch_row($result)) {
echo "<b>+</b> <a href=\"http://www.orientek.net/kore/gamerz/index.php?p=$data[0]\">$data[1]</a> ($data[2] Comments)<br>\n";
}
// Comments' Members Stats
echo "<br><br><div class=\"Title\">» Comments' Members Stats</div>\n";
echo "<table bgcolor=\"$tableborder\" cellspacing=\"0\" cellpadding=\"0\" align=\"left\">\n";
echo "<tr>\n";
echo "<td>\n";
echo "<table cellspacing=\"1\" cellpadding=\"2\">\n";
echo "<tr>\n";
echo "<td bgcolor=\"$topcell\"><b>No.</b></td>\n";
echo "<td bgcolor=\"$topcell\"><b>Members' Nickname</b></td>\n";
echo "<td bgcolor=\"$topcell\"><b>Members' Posts</b></td>\n";
echo "</tr>\n";
// Comments' Members Stats - MYSQL
$e = mysql_query("SELECT comment_author, COUNT(*) AS 'total' FROM gamerz_b2comments GROUP BY comment_author ORDER BY total DESC") or die(mysql_error());
$i=1;
while ($data = mysql_fetch_row($e)) {
echo "<tr>\n<td bgcolor=\"$menucell\">".$i."</td>\n";
echo "<td bgcolor=\"$menucell\">".$data[0]."</td>\n"; // holds the name
echo "<td bgcolor=\"$menucell\">".$data[1]."</td>\n</tr>\n"; // holds the number of comments
$i++;
}
echo "</table>\n</td>\n</tr>\n</table>\n";
echo "</td>\n</tr>\n";
// Categories Stats
echo "<br><br><div class=\"Title\">» Categories Stats</div>";
echo "<table bgcolor=\"$tableborder\" cellspacing=\"0\" cellpadding=\"0\" align=\"left\">";
echo "<tr>";
echo "<td>";
echo "<table cellspacing=\"1\" cellpadding=\"2\">";
echo "<tr>";
echo "<td bgcolor=\"$topcell\"><b>Category Name</b></td>";
echo "<td bgcolor=\"$topcell\"><b>Posts In Category</b></td>";
echo "</tr>";
$e = mysql_query("SELECT cat_name , COUNT(*) AS 'total' FROM gamerz_b2posts , gamerz_b2categories WHERE gamerz_b2posts.post_category=gamerz_b2categories.cat_ID GROUP BY gamerz_b2posts.post_category ORDER BY total DESC") or die(mysql_error());
while ($data = mysql_fetch_row($e)) {
echo "<tr>\n<td bgcolor=\"$menucell\">".$data[0]."</td>\n"; // holds the cat name
echo "<td bgcolor=\"$menucell\">".$data[1]."</td>\n</tr>\n"; // holds the post in the cat
}
echo "</table>\n</td>\n</tr>\n</table>";
// Referers Stats
echo "<tr>\n<td>\n";
echo "<br><br><div class=\"Title\">» Referers Stats</div>";
$list = topRefererList(10,"global");
foreach ($list as $link){
print "$link<BR>";
}
echo "</tr>\n</td>\n</table>\n";
?>
[/php:1:de031565ae] _________________
++ GamerZ.Per.Sg - Complex Simplicity |
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
|
Back to top |
|
 |
Tanner
Joined: 06 Jul 2002 Posts: 55 Location: Germany
|
Posted: Tue Aug 20, 2002 8:06 pm Post subject: |
|
|
Cool! :lol: |
|
Back to top |
|
 |
zootsuit
Joined: 17 May 2002 Posts: 14
|
Posted: Tue Aug 20, 2002 8:11 pm Post subject: |
|
|
I can't seem to draw it in to my site. maybe I'm being braindead today. |
|
Back to top |
|
 |
dotdotspace
Joined: 15 Mar 2002 Posts: 138 Location: Seattle, WA
|
Posted: Thu Aug 22, 2002 12:59 am Post subject: |
|
|
GamerZ, i'm working on modding your code to make it easier for it to integrate into b2.
basically since blog.header.php includes b2config.php, and you're including blog.header.php, i thought i'd use variables where you hardcoded the info. i also added a $blogfilename variable to store the exact filename of the person's b2, just to streamline the code.
i'll edit this post when i verify that it works. i'll email it to you so you can test it. i'll also write a readme, and make a zip with b2stats.php, refererLog.php, the readme, and give credit to the guy who wrote refererLog.php since the source code is available on his website.
simple hack, small distro.
edit 1: b2stats.php requires that you be running b2 v0.6, and not my outdated 0.5.1. 
Last edited by dotdotspace on Thu Aug 22, 2002 3:32 am; edited 2 times in total |
|
Back to top |
|
 |
GamerZ
Joined: 15 May 2002 Posts: 537 Location: Singapore
|
Posted: Thu Aug 22, 2002 1:43 am Post subject: |
|
|
Wow thanks man =) _________________
++ GamerZ.Per.Sg - Complex Simplicity |
|
Back to top |
|
 |
dotdotspace
Joined: 15 Mar 2002 Posts: 138 Location: Seattle, WA
|
Posted: Thu Aug 22, 2002 3:33 am Post subject: |
|
|
a preliminary stats file is available here. the readme will probably need reworking, but hey.. it's my first readme file!
Last edited by dotdotspace on Thu Aug 22, 2002 3:46 am; edited 1 time in total |
|
Back to top |
|
 |
zootsuit
Joined: 17 May 2002 Posts: 14
|
Posted: Thu Aug 22, 2002 3:35 am Post subject: |
|
|
dot all I'm getting at that link is this:
Quote: | CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: |
no source either |
|
Back to top |
|
 |
dotdotspace
Joined: 15 Mar 2002 Posts: 138 Location: Seattle, WA
|
Posted: Thu Aug 22, 2002 3:46 am Post subject: |
|
|
i fixed the link. it should've been to a zip file and not a php file.. |
|
Back to top |
|
 |
|