• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 365
  • Last Modified:

Have 2 db's, 1 for site and 1 for forums. Need to consolidate users


I have a flash game site and a forum for it and they have different db's. I actually just created the forums yesterday so there are only a few users. I want the users to only have to register once.

How can I do this?

mysql db.

In the db the prefixes are ava for the site and phpbb for the forum. I'm not sure how to go about this without breaking one of the sites.

pleas advise
thank you!
3 Solutions
You should do this:

1. Make a backup of db1 and db2 user's tables.

2. Add users on db1 to users on db2. You should think about how to solve the conflicts: if db1 and db2 have the same user what to do ?

3. Drop users table on db1.

4. Create a view on db1 with the same name users table had. This view should get data from db2 users table.

5. If you want to be able to add users on db1, create triggers for doing this, or modify your programming code (maybe php?) to insert to db2 table instead of db1.

Hope it helps.
Scott MadeiraCommented:
Another thing you will need to work through is how the passwords are stored in each database.  If they are encrypted but use differing mechanisms then you need a way to get the password sync'd.

Even if they are both using something simple like MD5 to encrypt, if they have different salts in their encryption you will get different passwords.

You may find that you have to create a custom registration form that gathers all of the fields required by both tables (some will be common to both and some will be unique to one or the other.)

With your custom registration form you would need to call the "create user" function in each of the two applications.
Ray PaseurCommented:
You can specify the data base name in the query or you can select a data base as the default DB for the queries.  With two DBs you might be best off putting the DB name directly into the query.

If both data bases are accessed via the same domain name, you can use http cookies to carry authentication information.  The general design for this sort of login-and-remember-me uses the PHP session with longer-term login patterns implemented by using a cookie.  You can see the moving parts and the code samples in this article.

Here is what I might try.  Add the userTable to one of the data bases.  Locate the authentication modules in each of the subsystems and replace those with something like the access_control() function described in the article.  Hook the registration and authentication queries up with the data base that contains the userTable.  This is not rocket science, just plodding work to check all the places that client authentication is used in the two subsystems.

As an alternative you might consider using http://en.wikipedia.org/wiki/OAuth or http://en.wikipedia.org/wiki/OpenId
DantechITAuthor Commented:
Thank you!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now