Web Hosting Talk







View Full Version : [PHP] Sync users table in databases between 2 portal sites


Georgecooldude
09-18-2004, 05:55 PM
I run a website using a webportal system phpwebthings.

I want to setup another website but not make users re-register as it would be great to have shared logins.

I only need to share the table called wt_users and its only a few rows within that table that need to be shared. Now how would you suggest I go about making a script that updates the wt_users tables in the other sites database everytime a new user registers? I would like it so a user could register on either site and then the member info would be replicated to the other databases via a master database.

At the moment I am thinking of having a master database that only contains user info I want shared from wt_users. Assume Jimbo registered on site 1 i then want that data sent to the master database containing user info and replicated to site 2 - This option I think requires modifiying the portal code. Or the master database could read the databases on sites 1 and 2 but that could create slow down and lag as it Don't want something continually checking for updates.

As the websites are built using a portal system I don't want to have to modify any code within the portal as it makes upgrading a pain.



Any suggestions to how I should go about this? I think Mambo portal already has this feature? How did they go about it? I am a a new programmer so some explanation would be great. Thanks

azizny
09-18-2004, 08:00 PM
Add an include in where the registration occurs on one system, include a file at which is will also register the user realtime..

it wont be a pain upgrading because all you will need to do is just remove the incliude line..
You will need to connect to the other host of the database and then just insert the user information.

Peace,

Georgecooldude
09-18-2004, 08:40 PM
Thats a good idea!

Ok. so if a user registered on site 1 or site 2 the data can be sent to the master database holding the users.

But how does it get from site 1 to master database to site 2?

At the moment were only creating links to the master database right?

mixDev
09-19-2004, 03:15 AM
if i understand things correctly, azizny's Idea is pretty good as you dont want to change any code. Connecting to a different server wont be that troublesome. Add a user with proper domain and table permissions in the mysql db 1. Then use this user to connect to the db1.

All the best.