Forum Moderators: coopster & phranque

Message Too Old, No Replies

auto login to a .htaccess protected directory

         

lindajames

10:08 am on Sep 19, 2003 (gmt 0)

10+ Year Member



Does anyone know how i can automatically login to a .htaccess protected directory without having to put the username and password in the url like this:

username:password@sitename.com

i have a perl script that is linking to a protected directory, at the moment i am linking it to the directory by embedding the username and password into the url, but i want to know if there is any scripting way around this?

Cheers

lindajames

3:44 pm on Sep 20, 2003 (gmt 0)

10+ Year Member



there must be a way to initiate a session using the htacess credentials so that the user gets logged in.

at the moment i have a link to a protected dir and when someone clicks on it, it prompts them for username and password. But i just realised that if i put a image tag with a height and width of "1" pixel calling the protected directory like this:

username:password@domain.com/protecteddir

then if i click on the link, it doesnt prompt me. So there must be another way to actually do this in perl rather than using a image tag?

below is the current code i have that uses the image tag:

print "<a href=\"http://mydomain.com/secure_folder/\">Forgot your password?</a>\n\n";
print "<img src=\"http://username:password\@mydomain.com/secure_folder/\" width=1 height=1>";

any ideas would be appreciated

Cheers