0

I am working on two domains sharing the same database table an same users. They are both hosted on the same box, but contain different data and serve two separate but similar purposes.

I have: Login process ** with **JQUERY and AJAX that works fine for both sites.

I want: Once the user is logged in one domain via the PHP function in the AJAX call, to send his information to the other domain, before the full response is sent back to jquery. In words, set up some kind of listen file in either domain that receives the user's info once they are logged in one of the domains and logs them in the other automatically.

So, jQuery in Site X ==> AJAX / PHP , which checks info, logs the use in site X, sends info to listener.php in site Y,==> back to jQuery in site X

JanvierDesigns
  • 71
  • 1
  • 10
  • Have you tried creating the listener you suggested? – Andy Mar 14 '14 at 12:23
  • To share data between servers you should use WEBSERVICES – Pedro Monteiro Mar 14 '14 at 12:23
  • @AndrewPope I tried using inclusion, but I can pass the paramaters with the inclusion – JanvierDesigns Mar 14 '14 at 12:42
  • If you're not tied to using ajax for login, you could redirect user from a.com to b.com/set-cookie-script which sets a login cookie for that domain, and upon return logs user into a.com – JohnnyFaldo Mar 14 '14 at 12:52
  • @JohnnyFaldo I know. I want Ajax though for the requirements of the client – JanvierDesigns Mar 14 '14 at 13:24
  • @JanvierDesigns Can you explain a bit more about the nature of this project, is the user going to visit b.com from a.com or vice versa, or does the client want them to be logged in just in case they happen to stumble across the other domain by chance? – JohnnyFaldo Mar 14 '14 at 14:47
  • @JohnnyFaldo: If the user is logged on a.com, they should automatically be logged in b.com and vice versa. So before the AJAX call sends the response back to the browser, some "inter domain" communication should be done so that the user authenticated in x.com may be authenticated in y.com too – JanvierDesigns Mar 14 '14 at 14:53
  • http://stackoverflow.com/a/8188519/1352271 – JohnnyFaldo Mar 14 '14 at 15:02

1 Answers1

1

You can pass data fairly easily to another website using a webservice, however you probably want to place security on it to ensure people don't hack your website.