views:

56

answers:

1

I read here how to get into an Apache password protected directroy via dircet link with the simple:

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

that works in FF/Chrome/Safari, and obviously not in IE7! :)

Do you know how could i get into a psw protected directory creating maybe a login form and using GET/POST to get in?

Do I need to set a session before getting in or I can simply pass to the protected directory the user and password as GET/POST parameters? (In this last case what name for parameters do I have to use?)

Thanks!

+4  A: 

What you're referring to is HTTP authentication, and is not handled with URL parameters or POST data.

A HTTP client must handle it directly.

Now, if you have no control over the password protected directory, there's nothing you can do.
If, however, you do have control and want to provide an HTML login form, you must change the method of authentication and, instead of relying on HTTP authentication, do it via URL parameters or POST data. You can do that not using a different authentication type module for a Apache (necessarily a third-party one, because Apache only supports HTTP Basic and Digest authentication), or, more realistically, doing the authentication with PHP and managing a session.

Artefacto
@Artefacto: thanks for the fast reply. Actually it is handled with URL paramaters cause the URL i posted in my question works on all browsers except IE.
Marco Demajo
@Marco Demaio By url parameters I mean the query string.
Artefacto
@Artefacto: oh ok, sorry, so basically you are saying there is no way. I know how to do it using PHP sessions, but you are saying there is no way to do query GET/POST authentication over HTTP authentication, aren't you? Just to know if I understood! Thanks!
Marco Demajo
HTTP authentication works at a different level than GET/POST parameters, and is handled differently by the browser.
Ignacio Vazquez-Abrams
@Ignacio: +1 and thanks for the comment/answer.
Marco Demajo