XP0Z3|) BY XP0Z10/\/ Forum Index XP0Z3|) BY XP0Z10/\/
Y0U\/3 0FF1C14LLY B33/\/ XP0Z3|)
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

b2 Stats hack

 
Post new topic   Reply to topic    XP0Z3|) BY XP0Z10/\/ Forum Index -> XP0Z3|) BY XP0Z10/\/
View previous topic :: View next topic  
Author Message
koew



Joined: 07 Aug 2003
Posts: 8
Location: Norway

PostPosted: Sun Mar 13, 2005 10:10 pm    Post subject: b2 Stats hack Reply with quote

Sigg3 wanted the b2stats hack, so here it is:
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");
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 "<a href=\"http://yourdomain.com/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 "$data[3] - $data[2] (<a href=\"http://yourdomain.com/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 Posts</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 "<a href=\"http://yourdomain.com/index.php?p=$data[0]\">$data[1]</a> ($data[2] Comments)<br>\n";
}

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


// End b2stats.php hack
}
?>


Type in your whole URL to your blogfile, like index.php, (usually ends in .php) wherever it says "http://yourdomain.com/index.php" in the code.

I'm not sure if I'm right, but I believe you can remove the
Code:
include ("blog.header.php");
...in the code if you've already have it somewhere in your html-code.

Godamn hacker nowadays! Why don't they get a real job!
*waving my right fist at the hackers/crackers*
_________________
"Arguing on the internet is like running in the special olympics.
Even if you win, you are still retarded."
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    XP0Z3|) BY XP0Z10/\/ Forum Index -> XP0Z3|) BY XP0Z10/\/ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can 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