MyBB Community Forums

Full Version: MyBB password encryption
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I'm integrating mybb with whmcs so when a user registers, they are also registered in mybb instead of just whmcs. How does mybb encrypt passwords as I would need to make a plugin for whmcs that takes a field called username, the email form, and the password form and insert them into the mybb database.
http://crossreference.mybboard.de/inc/da....html#l161

You might build an array of data, including the username, the email and the password, and let the validator do all the hard work for you.

require_once  MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler("insert");
$user = array("username" => $username,
    "password" => $password,
    "password2" => $password,
    "email" => $email,
    "email2" => $email,
    // ... (extra fields)
);
$userhandler->set_data($user);
if($userhandler->validate_user()) {
    $newuser = $userhandler->insert_user();
    // do whatever you want with the $newuser array. It contains the new user's data.
}

----- EDIT ------
Also, MyBB stores password without encryption, passwords are hashed using the md5 digest algorithm. The formula looks like this:

$hashedpsw = md5(md5($salt).md5($plainpassword));
/* $salt = random 8-chars long string
 * $plainpassword = the password in plain text
 * $hashedpsw = the hashed password
 */
Thank you for the suggestion, I'll keep that in mind. I don't know how whmcs encrypts passwords though, id like to do it so when a user changes their password in whmcs, it updates in the mybb database as well. Unless, I use mybb to store the billing profiles, and have whmcs use the mybb login table. Once I get a plugin working that works with whmcs, I'll release it so others looking to do the same will be able to.

Edit: Would it be easier to handle registration on the mybb side, and use WHMCS API to insert the data? http://docs.whmcs.com/API:Add_Client