Login Screen

I wan to use .htaccess to protect the directory but I don't link the pop-up login window.
Is any way I can use my login screen and still login to the protect directory?

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

joemacdConnect With a Mentor Commented:

I haven't used a Netscape server for a year or so, but perhaps you'd like to try a variation of a previous answer from above.

When you get the login/password from your login screen, have your script read them and then:
$URL= "http://" . $login . ":" . $password . "@www.site.com/page1.html";
print "Location: $URL\n\n";

This should immediately send the user to page1.html without the popup by creating the following URL:

If you don't like having the login/password in the URL, you can use a backdoor and have page1 be a script that immediately sends them to:

print "Location: http://www.site.com/page2.html";

They should now end up on page2.html (the destination) without having the popup box or a messy location bar.

1) The intermediate page (page1.html) still contains the messy URL with the login info, and if they hit "Back" they'll end up on page2 again.
2) The log files still have the login info.

Other than that, I think you're stuck with the popup box.
I don't know about IE, but Netscape allows you to access http://login:password@www.example.com/path/to/page.html

but this URL will get to your Location bar, which is probably not what you want.

Possible solution:
1) make login screen you want;
2) get your login/password via your script; check if they are correct (you can not realy on www server for this)
3) generate page stating "you are allowed to get in" with <img src="http://login:password@your.site.com/protected/dir/img.jpg">

when user's browser will download image - browser will be told what login/password pair is for this are, so when it will access your documents from this area it will reuse password already known.

1) your user still will be asked for password if he'll follow link _BEFORE_ image will be received;
2) there will be user's logins/passwords in server log 'cos for images browsers uses GET method.
jpchenAuthor Commented:
Look like that there is no other solution?
jpchenAuthor Commented:
  Look like is no other way right now.
Thanks for help.
All Courses

From novice to tech pro — start learning today.