0

I have a website named www.example.com and I want a login form there inside a modal where a user can login and once he clicked the submit button, he will be logged in at www.test.com and also automatically forwarded to www.test.com!

I looked for some include functions but I am not sure how to solve that issue? Does anyone has an idea or a link to a tutorial so that I can see how this may work?

Please let me know if you need some additional information.

Thanks, Chris

Christoph C.
  • 840
  • 2
  • 22
  • 38

1 Answers1

1

You could bring a login form from test.com into an iframe in example.com

<iframe src="http://www.test.com/login_form.php"></iframe>

your form, on test.com, should have the target set to "_top".

Then if login successful you are in www.test.com.

Else... you can redirect back to exemplo.com

Julio Soares
  • 1,200
  • 8
  • 11
  • Hmm..I already tried to solve it with an iFrame. Problem is that if I include the login page from www.test.com with an iFrame to the Modal on www.example.com than after a successfull login I stay inside the iFrame, therefore inside the modal window. This is not what I want. – Christoph C. Sep 10 '15 at 15:40
  • Did you set the form target to "_top" ? It should work It would redirect to the parent frame (the window) – Julio Soares Sep 10 '15 at 15:46
  • Yes I set it to target="_top" but I am still inside my modal once I am logged in! – Christoph C. Sep 10 '15 at 17:22
  • So you can't use that. :( Then... I got that both domains are yours... Are they both in the same server too? If so you could overide PHP's session handler with a custom one... take a look in http://stackoverflow.com/questions/6490875/how-to-manage-a-single-php5-session-on-multiple-apache-servers – Julio Soares Sep 10 '15 at 18:01
  • Sorry... The idea being share the session data among the 2 sites – Julio Soares Sep 10 '15 at 18:11
  • Just to make sure... in your form, within the iframe, were action set like: `action="/index.php"` or `action="http://www.test.com/index.php"` ? – Julio Soares Sep 10 '15 at 18:20
  • YES action is set like that! – Christoph C. Sep 10 '15 at 18:37