Click to See Complete Forum and Search --> : How do I password protect access to web page?


360
04-02-2001, 02:43 PM
What is the easiest way to password protect the access of a web page so a little box pops up and ask for username and password?

The only script language I know a little is PHP.

Thanks,

Gene

[ 02 April 2001: Message edited by: gene ]

jwilson
04-02-2001, 03:25 PM
Use a perl to store your username and password in a file on the server. then you can use an html form on the client to collect info and then submit it to the perl script which would check the form values against the values that you have stored in the file.

If they match, you proceed to the dsired page, if not, print an error message.

That's probably the easiest way.

ph34r
04-02-2001, 03:39 PM
Or setup .htaccess files.

Or do it the cheesey way -


Assuming you only need one user/pass combo, call your secret page foo.html

Use javascript (inputbox) to ask for the password, and append .html to the end of it. Document.location=<inputboxtext>+.html

If the password is wrong (foo in this case) then they get a 404 error instead of the uber-l33t secret page.

360
04-02-2001, 03:43 PM
What happens if the browser has java disabled?

Originally posted by ph34r:
Or setup .htaccess files.

Or do it the cheesey way -


Assuming you only need one user/pass combo, call your secret page foo.html

Use javascript (inputbox) to ask for the password, and append .html to the end of it. Document.location=<inputboxtext>+.html

If the password is wrong (foo in this case) then they get a 404 error instead of the uber-l33t secret page.