/    Sign up×
Community /Pin to ProfileBookmark

Automatic .htaccess Login

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.

to post a comment

8 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayApr 17.2007 — You'll be sending it clear text but you could do a redirect to:

http://username:[email protected]/protectedDir
Copy linkTweet thisAlerts:
@tonyb48authorApr 17.2007 — 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
Copy linkTweet thisAlerts:
@TheBearMayApr 17.2007 — Know it works under IE6, but haven't tried it under IE7; does it tell you what path it's looking for?
Copy linkTweet thisAlerts:
@tonyb48authorApr 17.2007 — Yes.

It says:

"Windows cannot find 'http://tonyb48:[email protected]/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
Copy linkTweet thisAlerts:
@TheBearMayApr 17.2007 — Just for the sake of argument, have you tried it without the index.html (in as much as that's usually the default).
Copy linkTweet thisAlerts:
@tonyb48authorApr 17.2007 — Yes.

Same message.

(without the index.html in the message, of course)
Copy linkTweet thisAlerts:
@ScriptageApr 22.2007 — 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
Copy linkTweet thisAlerts:
@tonyb48authorApr 22.2007 — 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
×

Success!

Help @tonyb48 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...