MyBB Community Forums

Full Version: md5() function in SQL db
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have exported my MyBB Users table into CSV with a guest account with all default columns.

I then replicated all columns from copying the guest account. I then replaced the username with my desired usernames, and tried to insert the plain text passwords, thinking the encrypting would kick in when a user logged in. Reimported this CSV into the database. Tried to login as a user with their password, not so lucky.

So, what I am asking, is there anyway to import this CSV into the database (users table) and have the password column encrypt the password when logging in. Basicly, I have usernames and password (no emails) that I want to use to populate this table.

I read previously about using the md5 function, but I'm not sure.
Any assistance would be very appreciated.
Try hashing it yourself?

MyBB does it like this:

function salt_password($password, $salt)
{
    return md5(md5($salt).$password);
}

You need to pass $password as the md5'd password. So in reality, it's like this:

return md5(md5($salt).md5($password));
Thank you for your time and effort, but I was trying to simply import from a CSV, not using PHP to import. I can complete the import, but when I try to log in from the front end of the BB, then it throws an invalid username/password. Interestingly, when I check the database, the password column is now encrypted from plain text, and the salt/loginkey is there.
I hope to feel the love soon...


(2013-01-15, 03:28 AM)Seabody Wrote: [ -> ]Try hashing it yourself?

MyBB does it like this:

function salt_password($password, $salt)
{
    return md5(md5($salt).$password);
}

You need to pass $password as the md5'd password. So in reality, it's like this:

return md5(md5($salt).md5($password));