Welcome to WebmasterWorld Guest from 188.8.131.52
If it's possible what's the best way to do this?
What you need to do is to point one script to connect to a remote host and access the database.
When connecting to mysql you use:
mysql_connect('localhost', 'username', 'password');
So basically you setup one database and access it locally by one script and remotely by the other:
mysql_connect('someremotehost', 'username' , 'password');
A third party runs our ecommerce site which collects user info including emails, passwords and addresses, etc.
We also have a legacy site that runs competitions and people can enter their details on this site which we use for marketing purposes.
If someone signs up to one it would be best if they were signed up automatically to the other site. If they log- in to one and move across it would be best if they were still logged-in. Apart from the URL changing the customer should never be aware that theyr'r moving from site to site.
It isn't feasible to end the competitions - much as I'd like. It also isn't feasible for us to simply send all our customer data to the third party running our ecommerce site with nothing in return plus that wouldn't help the logging in issue
joined:Nov 12, 2005
If you do not have access to the third-party host then you won't be able to implement this yourself, but maybe have them do it for you, or give you access to the host to do it.
To make moving from one server to the other transparent to the user, you'd need to set two cookies when they log in -- one for each server. But that would be a third-party cookie, which might be blocked by the browser.
Worst-case scenario, though, they'd have to log in twice.
I think the main way to solve this is to lobby for change and instead of having people logging in to enter competitions on a different website, merely have them enter their details for each competition they enter (and to make this work, really cut down on the amount of details we ask for).
I don't know about you but if I enter a competition on a website I don't expect to be signing up for a user account complete with password - that makes little sense to me and now I've thought about it a little, I've decided a rethink is necessary.