Helpful Information
 
 
Category: vBulletin.org Forum
Top Posters Hack?

Im looking for a hack that shows the top posters on your baords on the main page, so I can make it show up on my home page, anyone ever seen one?

SELECT user.posts, user.username FROM user ORDER BY user.posts DESC, user.username DESC LIMIT 0, 10

Wow thanks, but how do I, and what can I do with one line of code? What do i do to incorp it into a php file in another DIR

Sorry, I wasn't thinking...


<?php
require("path/to/global.php");

print("<table><tr><td colspan=\"2\">Top Posters</td></tr>
<tr><td><b>Username</b></td><td><b>Posts</b></td></tr>");

$db_link = @mysql_pconnect("$dbservername", "$dbusername", "$dbpassword");
mysql_select_db ("$dbname", $db_link);

$query = mysql_query("SELECT posts, username FROM user ORDER BY user.posts DESC, user.username DESC LIMIT 0, 10");

while($row = mysql_fetch_array($query))
{
$username = $row["username"];
$posts = $row["posts"];

print("<tr><td>$username</td><td>$posts</td></tr>");
}

print("</table>");

?>


Put this in any page you want to. Just change the path to global.php and the LIMIT statement to reflect how many people you want to display. It's set at 10.

HTH

-jim

THANKS MAN! Wow, this wasnt hard like it thought, sweet!

I did that and I get this error


Warning: Supplied argument is not a valid MySQL-Link resource in /web/sites/3/leokiller/www.flyaway.f2s.com/board/main.php on line 15

and on line 15 the only thing on is is this symbol -> {

help ... :(

help help help plzzzzzzz

try changing the lines to this:

$db_link = @mysql_pconnect("$dbservername", "$dbusername", "$dbpassword");
mysql_select_db ("$dbname", $db_link)
or die("Error connecting to DB");

$query = mysql_query("SELECT posts, username FROM user ORDER BY user.posts DESC, user.username DESC LIMIT 0, 10")
or die("Query Error:$query");

This should tell you where your error is...
Good Luck,

is sais error connecting to DB ,how is that possible ? It uses my global.php yes ? Well since my vbulletin shows no problems and connects without errors ,how can this script make an error connecting ? Please help , I really want this script to work

<html>
<head>
<title>blabla</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#000000" text="#CCCCCC" link="#CCCCCC" vlink="#CCCCCC" alink="#CCCCCC" leftmargin=0 rightmargin=0 bottommargin=0 topmargin=0>
<?php
require("global.php");

print("<table><tr><td colspan=\"2\">Top Posters</td></tr>
<tr><td><b>Username</b></td><td><b>Posts</b></td></tr>");

$db_link = @mysql_pconnect("$dbservername", "$dbusername", "$dbpassword");
mysql_select_db ("$dbname", $db_link)
or die("Error connecting to DB");

$query = mysql_query("SELECT posts, username FROM user ORDER BY user.posts DESC, user.username DESC LIMIT 0, 10")
or die("Query Error:$query");

while($row = mysql_fetch_array($query))
{
$username = $row["username"];
$posts = $row["posts"];

print("<tr><td>$username</td><td>$posts</td></tr>");
}

print("</table>");

?>


that's the script I use ,and this is the error I get :

Warning: Supplied argument is not a valid MySQL-Link resource in /web/sites/3/blabla111111/www.blabla.f2s.com/board/main.php on line 15
Error connecting to DB

$db_link is wrong I think , with what should I replace it ?

do you have this in the same directory had global.php? if not you have to have the full path for it to open it

it's in the same directory

Originally posted by JimF
Sorry, I wasn't thinking...


<?php
require("path/to/global.php");

print("<table><tr><td colspan=\"2\">Top Posters</td></tr>
<tr><td><b>Username</b></td><td><b>Posts</b></td></tr>");

$db_link = @mysql_pconnect("$dbservername", "$dbusername", "$dbpassword");
mysql_select_db ("$dbname", $db_link);

$query = mysql_query("SELECT posts, username FROM user ORDER BY user.posts DESC, user.username DESC LIMIT 0, 10");

while($row = mysql_fetch_array($query))
{
$username = $row["username"];
$posts = $row["posts"];

print("<tr><td>$username</td><td>$posts</td></tr>");
}

print("</table>");

?>


Put this in any page you want to. Just change the path to global.php and the LIMIT statement to reflect how many people you want to display. It's set at 10.

HTH

-jim

I got it to work by making a file inside the vBulletin folder, setting the global require path to just require("global.php"); and then called the file using the reltivie path (eg. include ("http://www.yourdomain.com/vBulletin/topposters.php") and everything worked nice and quickly.










privacy (GDPR)