vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   *New User* Hack on Non-VB Page >> Help (https://vborg.vbsupport.ru/showthread.php?t=27068)

badmeetsevil- 09-01-2001 03:46 PM

Okay, what I'm trying to do is get the New Username (latest signup) on a non-vb page. Here's the .php file I made:

PHP Code:


<?php

require("admin/config.php");

$dbclassname="admin/db_$dbservertype.php";
require(
$dbclassname);

$DB_site=new DB_Sql_vb;

$DB_site->appname="VBulletin";
$DB_site->appshortname="VBulletin (forum)";
$DB_site->database=$dbname;
$DB_site->server=$servername;
$DB_site->user=$dbusername;
$DB_site->password=$dbpassword;

$DB_site->connect();


$getnewestusers=$DB_site->query_first("SELECT userid,username FROM user WHERE userid=$numbersmembers[max]");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid'];


echo 
"<a href=member.php?s=&action=getinfo&userid=$newuserid>$newusername</a>";

?>

Instead, I get the

"There seems to have been a slight problem with the database. Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience."

..error. What did I do wrong!?

badmeetsevil- 09-02-2001 06:45 PM

*bump*

Admin 09-03-2001 03:03 PM

I'd just save this file as newest.php or something like that:
PHP Code:

<?php

error_reporting
(7);

require(
"./global.php");

$getnewestusers=$DB_site->query_first("SELECT userid,username FROM user ORDER BY joindate DESC LIMIT 1");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid'];

echo 
"<a href=member.php?s=&action=getinfo&userid=$newuserid>$newusername</a>";

?>

But anyway, your problem is that:
a) you're missing the 's in your query:
Code:

$getnewestusers=$DB_site->query_first("SELECT userid,username FROM user WHERE userid='$numbersmembers[max]'");
and b) where are you getting $numbersmembers[max] from? You need to use another query to get it:
PHP Code:

$numbersmembers=$DB_site->query_first('SELECT MAX(userid) AS max FROM user'); 

So your file should look like this:
PHP Code:

<?php

require("admin/config.php");

$dbclassname="admin/db_$dbservertype.php";
require(
$dbclassname);

$DB_site=new DB_Sql_vb;

$DB_site->appname="VBulletin";
$DB_site->appshortname="VBulletin (forum)";
$DB_site->database=$dbname;
$DB_site->server=$servername;
$DB_site->user=$dbusername;
$DB_site->password=$dbpassword;

$DB_site->connect();

$numbersmembers=$DB_site->query_first('SELECT MAX(userid) AS max FROM user');
$getnewestusers=$DB_site->query_first("SELECT userid,username FROM user WHERE userid='$numbersmembers[max]'");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid'];


echo 
"<a href=member.php?s=&action=getinfo&userid=$newuserid>$newusername</a>";

?>


badmeetsevil- 09-03-2001 03:33 PM

Wow dude! It works! Thanks a bunch man.

Admin 09-03-2001 03:52 PM

Hehe, no problem. :)


All times are GMT. The time now is 03:18 AM.

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.01176 seconds
  • Memory Usage 1,740KB
  • 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
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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