celsowm
celsowm

Reputation: 404

Php redirect with http authentication

How to redirect to a url and pass through in php the login and password http, ie, the http basic login but without user interference? without login pop-ups !

thanks, celso

Upvotes: 0

Views: 2752

Answers (3)

oezi
oezi

Reputation: 51807

don't know if i understood you right, but if you only want to redirect to a http-auth-secured site without the annoying popup, you can sent the username and password in the url:

http://username:[email protected]/adminpanel/

note that, with this solution, the password is readable in the url and some browsers (IE only <=6, this was disabled in the newer versions) don't support this - maybe thats a problem for you. for more information, take a look at this article

Upvotes: 1

symcbean
symcbean

Reputation: 48357

Short answer is that you can't.

Redirecting to http://user:[email protected]/ will work on some browsers but not all.

You could use a substitute authentication module, and push a value into it - e.g. using mod_authmemcookie on Apache if you're happy to tweak the server config like this (and have a cookie you can use).

Upvotes: 2

Brad
Brad

Reputation: 163282

With basic auth, the browser will re-send credentials when requested by the server. This only works for the same hostname though.

Upvotes: 0

Related Questions