Click to See Complete Forum and Search --> : Automatic .htaccess Login


tonyb48
04-16-2007, 10:54 PM
I have a site for school alumni. Some of the content is generated from my PERL-managed MySQL database. Another couple dozen pages are generated by others via Macromedia Contribute. I put these pages in a directory protected by .htaccess. When a user joins my database I also place her name & password into the .htpswd file. How can I arrange for the user to log in to this system only once? Right now she must log in to my database system and log in again when she wants to see some of the other pages. I would like her to log in to my database system once and use my script to log her in to the .htaccess area. Thanks in advance for your help.

TheBearMay
04-17-2007, 08:43 AM
You'll be sending it clear text but you could do a redirect to:

http://username:password@www.yoursite.com/protectedDir

tonyb48
04-17-2007, 10:27 AM
This is exactly the answer I was looking for. Clear text is OK. However, when I entered the URL you suggested into my browser (with appropriate changes, of course) it did not work in IE7. I got a dialog box reporting "Windows cannot find..." Any clues here?

In Firefox it worked. But I got an extra alert box saying: "You are about to login to ...." That is certainly better than requiring another login, but is there any way to avoid that extra mouse click?

Thank you so much for helping me.

Tony

TheBearMay
04-17-2007, 01:26 PM
Know it works under IE6, but haven't tried it under IE7; does it tell you what path it's looking for?

tonyb48
04-17-2007, 03:07 PM
Yes.
It says:
"Windows cannot find 'http://tonyb48:3451@www.tonybarre.com/restricted/index.html'. Check the spelling and try again."
This is just a practice zone for the moment, so you are welcome to try using those same credentials.
Thanks again
Tony

TheBearMay
04-17-2007, 03:16 PM
Just for the sake of argument, have you tried it without the index.html (in as much as that's usually the default).

tonyb48
04-17-2007, 04:00 PM
Yes.
Same message.
(without the index.html in the message, of course)

Scriptage
04-22-2007, 08:30 AM
Due to security reasons IE7 does not allow the username:password combination for logging in to .htaccess protected areas.

It is simply not possible to do as you wish. The best way around this problem is to have a log in link (which is basically a link to a file in your protected area ) and have the users enter their log in details into the standard .htaccess log in box.

The only other way around this is using CGI and a lot of coding.

Kind Regards

Carl

tonyb48
04-22-2007, 03:08 PM
Hi Carl,
Thank you very much for responding to my problem. I found a Perl command that somehow manages to elude the IE7 trap. Although the "redirect" command suffers from the problem (works in Firefox, fails in IE7), a module called LWP::Simple contains a command called "getprint" which works even in IE7.
Cheers,
Tony