Jump to content

mirror username password field


Recommended Posts

I think this is where this question should be asked. please let me know if I posted on the wrong forum.


I was wondering if someone could give me some guidance in mirroring 2 databases with their username and password fields only.


I have 2 databases that I would like to mirror with the username and password. Is it possible if so, please help.

Do i setup a script? cronjob?


Thank you!

Link to comment
Share on other sites

Do you really want the two databases (er, username/password columns) "mirrored", or do you want the user to be able to log into both "applications" using the same information?


Could you just use two connections -- one to your database with the uname/pass and one to the other -- within the same script?  Use just one table for authentication.


Or put a line of code in each application which INSERTs the info in the other database.


If this sounds okay, see the PHP manual for using multiple database connections -- it'll be under mysql_connect, and you'll need a variable to keep track of which connection.

Link to comment
Share on other sites

I really want the fields username/password to be mirrored. I have 2 applications (one is xoops) and another custom application.  I want them to be able to use the username/password from xoops on the new application and vice versa without having to create an account on the custom application.  I already have the username and password field and authentication method for the custom application (able to login if I create the account).


I've looked at the manual but unable to get anywhere. I'm a newbie at mysql and php. any help will be greatly appreciated.

Link to comment
Share on other sites

Why don't you just run an extra query on an CREATE/UPDATE of a particular database?


For an xoops CREATE or UPDATE:

INSERT INTO users (username,password) VALUES ('xxx','yyy');
INSERT INTO customapp.users (username,password) VALUES ('xxx','yyy');

UPDATE users SET password='zzz' WHERE username='xxx';
UPDATE customapp.users SET password='zzz' WHERE username='xxx';


Reverse it for the other way around.  You'll need permissions on both databases.  You'll also need to check for the presence of a pre-existing username on the opposite database previous to INSERTing any values.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.