manually add new users via database

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Anti-Spam Guide
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
Caruanas
Registered User
Posts: 10
Joined: Tue Aug 07, 2007 9:25 pm

manually add new users via database

Post by Caruanas »

Hi all.

I was searching through the forum but could not find a topic which dealt with my issue, so apologies if I have missed it in case it has been posted already.

I have a website which requires user registration (you know, the usual login stuff), and upon their registering as website users I'd like to automatically add them as users of the site's phpbb forum.

I have seen that there is a mod which enables the administrator to add users from the admin console, however what I need is an IMMEDIATE inclusion upon their registering (in other words, so that if they want, they can immediately start participating in the forum as registered users).

Anyone knows how to do this?

Cheers!
Stephen
User avatar
Jleagle
Registered User
Posts: 340
Joined: Tue Jun 24, 2003 7:40 pm
Location: England
Contact:

Re: manually add new users via database

Post by Jleagle »

Using something like phpmyadmin look at the column names in the users table. Then just insert the user into the phpBB database the same as you save the users when they register at your site.
Caruanas
Registered User
Posts: 10
Joined: Tue Aug 07, 2007 9:25 pm

Re: manually add new users via database

Post by Caruanas »

I see. So there aren't any fields hidden deep down in some unknown tables (heh) which need to be modified as well? It's a straight and simple entry in a single user table.

hmm, i see. Well, i guess that's good news then, since it makes life much simpler this way! :)

Thanks for the help!
Stephen
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52111
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: manually add new users via database

Post by Brf »

In addition to adding them to the users table, your should also create a user_group record to add them to the Registered Users group.
Caruanas
Registered User
Posts: 10
Joined: Tue Aug 07, 2007 9:25 pm

Re: manually add new users via database

Post by Caruanas »

I see! Thanks :D
ReddMurphy
Registered User
Posts: 13
Joined: Thu Sep 06, 2007 3:44 pm

Re: manually add new users via database

Post by ReddMurphy »

I have added a new user record in the database and a record in the user group but I still can't log in with the user credentials. Is there anything else I need to do? I noticed the password is encrypted for the users created normally, but my new one is not. Could that be the problem?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52111
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: manually add new users via database

Post by Brf »

Yes. You need to md5-hash the password.
ReddMurphy
Registered User
Posts: 13
Joined: Thu Sep 06, 2007 3:44 pm

Re: manually add new users via database

Post by ReddMurphy »

Brf wrote:Yes. You need to md5-hash the password.

Crap. I don't suppose that's an easy thing to do in SQL Server by any chance?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52111
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: manually add new users via database

Post by Brf »

What are you using to build your SQL query?
php uses the md5() function.
ReddMurphy
Registered User
Posts: 13
Joined: Thu Sep 06, 2007 3:44 pm

Re: manually add new users via database

Post by ReddMurphy »

Brf wrote:What are you using to build your SQL query?
php uses the md5() function.

I am doing this in SQL Server. I'm writing a trigger to update the phpbb database when a change is made to my site's database. So there's no php involved.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52111
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: manually add new users via database

Post by Brf »

So you are using transact-SQL to copy the data from your other tables to phpBB's tables.... I do not believe there is a md5() function in transact-SQL, although I am sure one could be written....
ReddMurphy
Registered User
Posts: 13
Joined: Thu Sep 06, 2007 3:44 pm

Re: manually add new users via database

Post by ReddMurphy »

Brf wrote:So you are using transact-SQL to copy the data from your other tables to phpBB's tables.... I do not believe there is a md5() function in transact-SQL, although I am sure one could be written....
I think I found one. I'll give it a try and post my results later. Thanks for your help.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52111
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: manually add new users via database

Post by Brf »

This site: http://www.codeproject.com/database/xp_md5.asp
has a DLL you can install on your SQL server, that will do md5 hashing.
ReddMurphy
Registered User
Posts: 13
Joined: Thu Sep 06, 2007 3:44 pm

Re: manually add new users via database

Post by ReddMurphy »

Brf wrote:This site: http://www.codeproject.com/database/xp_md5.asp
has a DLL you can install on your SQL server, that will do md5 hashing.
Sweet. Thanks!
Locked

Return to “[3.0.x] Support Forum”