Forum Moderators: coopster

Message Too Old, No Replies

Access .htaccess protected areas using a PHP script

Using a form to access protected areas

         

chriswragg

4:42 pm on May 6, 2005 (gmt 0)

10+ Year Member



What I want to do, is to have a user input their user and pass into a form to allow direct access a htaccess protected area. I want to know how to use a php script to acheive this.

I have seen various sites use this rather than having a password box appear.

Any help would be appreciated

Chris

If this post may be more appropriate posted in the Apache Web Server forum please tell me!

jatar_k

4:55 pm on May 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



does this help?
[php.net...]

chriswragg

7:21 pm on May 6, 2005 (gmt 0)

10+ Year Member



Hmmmm not sure...

From the looks of things, this still uses the username and password box. I want to be able to use a form on a webpage to access the .htaccess protected area.

jatar_k

9:00 pm on May 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I have done regular user/pass and the method with the standard htaccess box but haven't even seen the way you are talking about.

are you sure it is htaccess'ed with a reg login box?

chriswragg

7:10 am on May 7, 2005 (gmt 0)

10+ Year Member



Th most common place I have seen this used is on webhosting websites.

On my webhost (Which I will call examplehost.com) they have a form on the main index.php page. I have looked at the HTML and this form is posted to login.php.

Once you post the form you a redirected to secure.examplehost.com. If you simply typed in the address in the address bar, you would recieve the User Pass box.

I can't be sure that this is using htaccess though.
I did notice that you are redirected to https: rather than a http:, would this make a difference?