How to send username/password to htaccess?

I have a secure php page (SSL encrypted) with a form that will accept a username and password. My site is hosted on a LAMP server, but I only want to use htaccess for authentication since I only have a few users who need access to secure areas. So, I created a new directory off public_html (secret_docs) and in that directory there is a .htaccess file that looks like this:

AuthType Basic
AuthName "qqq"
AuthUserFile "/home/mydirectory/.htpasswds/secret_docs/passwd"
require valid-user

My question is - how can I forward the username and password from the form on the SSL encrypted page to this htaccess file, and if the credentials match, redirect the user to a page in that directory - otherwise send to a "login failed" page?

Any suggestions welcome! Thanks in advance.

 

 

 

 

Top