Home: Perl Programming Help: Intermediate:
.htaccess by passsing with browser login.



CuzDesign
Deleted

Apr 14, 2001, 9:53 PM


Views: 1034
.htaccess by passsing with browser login.

Hello,
Is it possible to create a small program that will bypass the .htaccess pop-up window?

What I want to do is have a log-in form on the web page
where the user enters there information and this is checked for proper login in the
.htpasswd file. I know how to do that but I don't know how to make it where they never see the .htaccess pop-up window.

I only want the to have to enter there username and password once but I want it entered into a form not into the pop-up window.

If anyone knows of a way or somewhere I can get more information on this please let me know.

Thanks in advance.

Ray



sleuth
Enthusiast / Moderator

Apr 16, 2001, 3:10 AM


Views: 1027
Re: .htaccess by passsing with browser login.

 Hey Mate,

Well, the first step is to build you form and everything, get your script to read the user/pass fields, then print location to the protected directory with the user/pass information in the url. This will by pass the login promt if the user/pass is right.

So your code would look kinda like this

#read form code
blabla
verify user and pass

$URL="http://$username:$password@www.yourdomain.tld/directory";
if($logged_in){
print "Location: $URL\n\n";
}

Get what I mean, just have to redirect to the url, so don't print "Content-type: text/html\n\n"; unless their login is wrong.

I havn't been able to test out that url login thing since I've been too busy to setup a pass protected dir right now so I hope it works. First try to get into the protected directory by url then you'd be set.

Man, I'm beat, Nighters

Good Luck Ray,

Tony