Jump to content

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.
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
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
  • 4 months later...
[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
  • 5 years later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.