MyBB Community Forums

Full Version: import users in db
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello
I have a text file lixe

user
[email protected]
password

user1
password1
[email protected]

user2
password2
[email protected]

...

How can import this members list in mybb db?

Thanks
This needs some more steps to achieve.

First you need to convert this user stanza to an appropriate SQL syntax:
INSERT INTO mybb_users (username, email) VALUES ('user', 'password');
INSERT INTO mybb_users (username, email) VALUES ('user1', 'password1');
INSERT INTO mybb_users (username, email) VALUES ('user2', 'password2');

Then the passwords needs to be converted/hashed/salted.
What is the current password look like, plaintext or md5 hashed? Both can be used to convert to fit MyBB.
You need to grab the piece of MyBB PHP source code to convert the passwords and create a salt.

Third you need to fill up all necessary and missing values in table mybb_users, e.g.
postnum=0
threadnum=0
regdate=<timestamp>
lastactive=<timestamp>
lastvisit=<timestamp>
and more...
Best practise, set up a default user configuration in ACP and then create a new user as reference/template for all new users to insert. Export this user row and replace username, email with contents of your list.

Without knowledge in file manipulation, SQL and PHP this will be a tricky action.

[ExiTuS]
I would highly suggest writing a PHP script to use the user datahandler to insert users as this will make sure they're valid, rather than trying to insert them with SQL queries.