MyBB Community Forums

Full Version: mybb database
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
how can be add into myBB through an API or in some way new users?
You would need to modify the code to do what you want. I'm not sure what your trying to achieve.
im trying to intergrate mybb forums with my site accounts, so users dont have to create a new account, they can use the same username as on the site
If you're using an external registration script to "add" a user to MyBB's database, just use mysql_query() to insert a new row into mybb_users.
$password = md5($plain_text_password);
$time = time();
mysql_query("INSERT INTO mybb_users (username, password, email, usergroup, regdate, allownotices, hideemail, emailnotify, invisible, receivepms, pmpopup, pmnotify, timezone, dst) VALUES ('$username', '$password', '$email', '2', '$time', 'yes', 'no', 'no', 'yes', 'no', 'no', '+1', 'no')");
Something like the above. (assumes you already have a MySQL connection to the MyBB database)
DennisTT Wrote:If you're using an external registration script to "add" a user to MyBB's database, just use mysql_query() to insert a new row into mybb_users.
$password = md5($plain_text_password);
$time = time();
mysql_query("INSERT INTO mybb_users (username, password, email, usergroup, regdate, allownotices, hideemail, emailnotify, invisible, receivepms, pmpopup, pmnotify, timezone, dst) VALUES ('$username', '$password', '$email', '2', '$time', 'yes', 'no', 'no', 'yes', 'no', 'no', '+1', 'no')");
Something like the above. (assumes you already have a MySQL connection to the MyBB database)

Hi !

I have a problem with regestering a member from a form I created on my website.

1- There's a field in the DB who's called "salt". I red some posts from the other members and I think the code for it is something like that :

$saltedpw = md5( $salt . md5( $password ) );

Is that right ?

2- I just CAN'T understand how is crypted the "loginkey" field in the DB... If someone could just give me the code line, I would be very grateful !

Thanks a lot !
Mensik
If you insert the user with only the password hashed by md5 (do not insert salt, or login key), MyBB will automatically generate the salt and login key needed.

Also, there's nothing encrypted in the login key. It's only used to set the cookie on the user's browser when the user logs in. (You can see the mybbuser cookie is {uid}_{loginkey}). We used to have the cookie contain the md5 hash of the password, but we deemed that was a weak point and replaced it with the login key.
Hi,

It works fine, but I still have a problem.

The registration part is okay, but when I look at the bottom of my forum index, I don't see the username of the last person registred on the "newest member" line.

It's very strange because when I go in the Memberlist, I see the username...
I can look at the profile and everything is okay....Strange eh ?!

If anyone could help me, that would be great !

Thanks Again Dennis !
Mensik

EDIT : I forgot to tell you that I'm even able to log in with the informations of the "invisble" members !
You need to run $cache->updatestats(); after you insert the user.

Cheers,
Tikitiki
Hi !

Thanks for the quick answer !
But please excuse my ignorance but, how can I run it ?

Just by putting this code in my registration page ?
Thanks,

Mensik
Yeh. If you did not include the global.php file you will need to include it or find another way to include the cache functionality. Then put the code above in your registration page. It will cause errors if you did it wrong.
Pages: 1 2