vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   change password programmatically (https://vborg.vbsupport.ru/showthread.php?t=124581)

denniss 08-21-2006 07:07 PM

change password programmatically
 
Hi,

I'm using vB 3.5.4. I want to change a user's password 'programmatically' (ie from a php program on the same host, but outside vB).

How do I do that?

Dennis

Billspaintball 08-24-2006 12:39 AM

Quote:

Originally Posted by denniss
Hi,

I'm using vB 3.5.4. I want to change a user's password 'programmatically' (ie from a php program on the same host, but outside vB).

How do I do that?

Dennis

You cant.

The vB password is encripted.
If you try and change it outside of vB, then vB will not authenticate the new password.

Zachery 08-24-2006 04:13 AM

Quote:

Originally Posted by Billspaintball
You cant.

The vB password is encripted.
If you try and change it outside of vB, then vB will not authenticate the new password.

This is not true, the password is _not_ encrypted, its hashed twice with a salt once.

[sql]
UPDATE user
set password = MD5(concat(MD5('<NEWPASSWORD>'), user.salt))
WHERE userid = <USERID>[/sql]

i believe I've got marco to thank for this one.

Billspaintball 08-24-2006 06:20 AM

Quote:

Originally Posted by Zachery
This is not true, the password is _not_ encrypted, its hashed twice with a salt once.

Sorry, bad choice of term on my part.
Maybe I should have just said its not plain text.

denniss 08-25-2006 04:47 PM

By 'outside vB' I mean programmatically through the vB API, but not a vB page per se.

so I am trying to use a function to change the password and I get this error:

Fatal error: Call to a member function query_first() on a non-object in /usr/local/apache/htdocs/forum/includes/functions.php on line 1600

the function body is this:

function changepassword($newpw) {
global $vbulletin;
$vbuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
$vbuser->set_existing($vbulletin->userinfo);

$vbuser->set('password', $newpw);

if ($vbuser->errors) {
foreach ($vbuser->errors as $error) {
echo "<br> error: $error";
}
} else {
// no errors, so save new vbuser.
$vbuserid = $vbuser->save();

}
}


All times are GMT. The time now is 09:01 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.01020 seconds
  • Memory Usage 1,717KB
  • 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
  • (3)bbcode_quote_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