vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Query in plugin simply wont work? (https://vborg.vbsupport.ru/showthread.php?t=311250)

principle_slw 05-11-2014 10:31 AM

Query in plugin simply wont work?
 
Hi I'm using the plugin register_addmember_complete and can not for the life of me get this to work. All i'm looking for is the users password hash

HERE are the current contents.

$uidn = $vbulletin->userinfo['userid'];
$db = $vbulletin->db;

$a = $db->query_first("SELECT password FROM user WHERE userid = '4' ");

vbsetcookie('userid', $vbulletin->userinfo['userid'], true, true, true);
vbsetcookie('password', md5($a . COOKIE_SALT''), true, true, true);
vbsetcookie('useridtmp', $a, true, true, true);

$a is empty so my password is simply set to a hash of my cookie salt?

---------------------------------------------------------------------------------
I've also tried this,

vbsetcookie('userid', $vbulletin->userinfo['userid'], true, true, true);
vbsetcookie('password', md5($vbulletin->userinfo['password'] . COOKIE_SALT), true, true, true);

Same thing $vbulletin->userinfo['password'] is blank? so once again password cookies becomes just a hash of the cookie salt

-------------------------------------------------------------------------------------

I've also tried this

$uidn = intval($vbulletin->userinfo['userid']);
$newpw = $db->query_read("SELECT password FROM user WHERE userid = $uidn");

Nothing seems capable of simply returning the users password?

Any help greatly appreciated.
Thanks

kh99 05-11-2014 10:47 AM

$db->query_first() will return an array (even if you are selecting only one field), or else NULL if it fails. So you should check for NULL, but maybe just try using $a['password'] and see if that works.

Edit: also I don't think $vbulletin->userinfo has been updated at that point (since the user was just created), so try using $userinfo and/or $userid instead. And of course using those is probably better than doing your own query.

principle_slw 05-11-2014 02:21 PM

Thanks very much you where correct $db->query_first() was returning an array.

Thanks for the help


All times are GMT. The time now is 03:55 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.00938 seconds
  • Memory Usage 1,708KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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