Re: using htaccess and html forms
| From: | Chris Adams | Date: | Wed, 12 Jul 2000 19:00:19 +0000 |
| Subject: | Re: using htaccess and html forms | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6224@lists.php.net to get a copy of this message | ||
> I have created a form that requires the user to enter their Username and
> Password which I check against a MySQL database. Based on the user,
> they are then sent to another page that is protected with a .htaccess
> file. Is it possible, without using cookies, to pass this data
> (Username, Password) from my form into .htaccess so that the users do
> not get the Username: Password: prompt from .htaccess? I want the
> functionality of the .htaccess, but I don't want the login prompt that
> appears. Any suggestions?
Not cleanly. You could proxy internally
(fopen("http://$Username:$Password@$HTTP_HOST/$PHP_SELF?$QUERY_STRING"))
but
that'd be kludgy. If you must use both PHP authentication and Apache's
authentication (it'd be best to rearrange things so you don't) you could
switch your PHP login page to use HTTP authentication (See
http://www.php.net/manual/features.http-auth.html);
that way the browser
would already have the username and password stored for that realm and would
pass them transparently when requesting the .htaccess protected pages.