vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Top Posters Hack? (https://vborg.vbsupport.ru/showthread.php?t=7940)

snyx 02-07-2001 10:55 PM

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?

02-07-2001 11:08 PM

Code:

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

02-07-2001 11:26 PM

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

02-08-2001 12:24 AM

Sorry, I wasn't thinking...

PHP Code:

<?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

02-08-2001 11:55 AM

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

02-18-2001 01:03 PM

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 -> {

02-19-2001 01:58 PM

help ... :(

02-21-2001 12:05 PM

help help help plzzzzzzz

02-21-2001 05:54 PM

try changing the lines to this:
PHP Code:

$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,

02-21-2001 06:03 PM

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

02-21-2001 06:06 PM

<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

02-21-2001 08:01 PM

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

02-22-2001 04:26 PM

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

02-22-2001 05:11 PM

it's in the same directory

02-23-2001 08:37 PM

Quote:

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

PHP Code:

<?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.


All times are GMT. The time now is 12:38 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01190 seconds
  • Memory Usage 1,766KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (15)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete