Jump to content

Archived

This topic is now archived and is closed to further replies.

scotch33

autologin to .htaccess protected directory through php - how?

Recommended Posts

Hi,

I have a site where the user arrives and is asked to validate themselves.  If the validation is correct then the header of the  php page takes them to site version a, if not they are given the choice of going to site version b or leaving completely.

Thats all done ands working - now I want to password protect site version A (an oscommerce install with private member prices) which I am planning to do with .htaccess. 

Where I come unstuck is how to use php to send the .htaccess username and password in the header so that the user does not have to log in.  This is because users are members of groups that will know their group details but we don't ever want them to have the actual login and password to the protected directory.

Is there a was of doing this, or if not, is there a better way to protect the directory and then have the header/form auto login to the system.

Thanks!

John.

Share this post


Link to post
Share on other sites
I think that the short answer is no.  It can be done the other way around, you can log into an .htaccess protected directory and automatically be authenticated with php, but not the other way around.

Regards
Huggie

Share this post


Link to post
Share on other sites
That being the case - does anyone have any php password software / member area software that they can suggest as a good start?  one that I can auto login via hidden form fields in the header would be the sort of thing I am after.

Failing that I guess I can simply put an if query in the header of each 'memberpage' so that if the cookie I store on the user's pc containing a password etc will validate or if not will send them elsewhere.

Apart from the potential for users not accepting cookies can anyone see an issue with this method

Share this post


Link to post
Share on other sites
[quote author=HuggieBear link=topic=112913.msg458503#msg458503 date=1161946561]
I think that the short answer is no.  It can be done the other way around, you can log into an .htaccess protected directory and automatically be authenticated with php, but not the other way around.

Regards
Huggie
[/quote]

Would you mind telling me how you would do this then?

This would work for what I am trying to do.

Thank you.

Keith G

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.