shah
shah

Reputation: 47

How to redirect user to different site?

I have a wordpress site, and I want to put a link on that site so that users are redirected to another PHP site.

But here the problem is that the other php site uses authentication, i.e. users need to give username and password before they can enter.

I want to develop a link that users can simply click on and get to the other site directly.

I can give the username and password for the php site, but the requirement is that the user users are not asked for username and password.

Upvotes: 2

Views: 109

Answers (4)

Jason
Jason

Reputation: 13766

If you have no control over the target site, then your options are very limited. You can't just provide access to material that requires login credentials without providing those login credentials.

Your best, and most secure, bet is to include the target site's login fields directly from their site in an iframe. The user logs into the other site, you track the iframe onload event to see that it changed, and then redirect the user to the page in question. This is better because it keeps you from handling the login details directly on your site.

I cannot guarantee that this works as simple as that, I haven't tried it and this page seems to indicate that at least some of the possibilities with cross-domain iframes are no longer relevant with modern browsers (I didn't read the page in detail, just trying to give a starting point).

Upvotes: 0

Jasri Samad
Jasri Samad

Reputation: 21

you have to make a new php file(in the 'php site') that assign the session variable to the linked users, and then it redirect them to the main page of the 'php site'

Upvotes: 2

MIIB
MIIB

Reputation: 1849

if i get you right, i think the best way is to generate the link in wordpress site with a parameter : http://www.linktophpsite.com/?autologin=true Then at php site you could get the element and if it is set to true, you can log the user to your site. If you want single sign-on on both sites, that's totally different. I recommend you to read articles about single sgn-on on php

Upvotes: 0

Sriniwas
Sriniwas

Reputation: 515

U have to write an authentication function on the other php site.. when the user clicks on the link of the wordpress site redirect him to that authentication function, along with his credentials, where the users will get logged in automatically and get redirected to your php site.

Upvotes: 0

Related Questions