Can I make somthing that requires a password to open an HTML page?

I'm working on a website and i'm posting a page that I don't want anyone to be able to open. Is there a way I could set somthing up so instead of a link to that page, there's a password box so when I type the one password that will work and press submit it will open the page?
 
If you have a UNIX host all you have to do is create two files: .htaccess and .htpasswd

Then when someone goes to see anything in that particular directory they will be asked for a username and password.

When they enter the username it will be checked inside the .htaccess file (you can add the usernames allowed using any text editor). As for the password is a bit trickier, and the password inside the file needs to be encrypted. For example the password encryption for the word 'test' is 'vq3OGHpnFivDI' (or something like that depending on the encryption you use), and it needs to be preceded by the username you created in the other file and a colon.

For example let's say you want to have the username 'george' and the password 'bush'.

You can open any text editor (not a word processor, something like Microsoft Word won't work, but Notepad will do the trick) and type the word 'george' (minus the quotes) inside of it. then save the file with the name .htaccess (note that there is no other extension, like .txt, that is the WHOLE name).

then create a new document, inside of it, type 'george:dyl5rNY6/mL0U' (minus the quotes) and save the file with the name .htpasswd (again no .txt after it)

Upload them to your host account in ASCII mode.

If you want to use a different password, here is a web site where you can get any word encrypted: http://users.abac.com/cgi-bin/pass.pl

Keep in mind usernames and passwords need to be 2 to 16 characters, lower case letters or numbers only, no special characters. And also this will protect ALL files in that directory, there is no way to protect just one file with this method.
 
Mmmm......good question...probably pay a monthly fee to a site like godaddy.com or something....
 
Put a .htaccess file in the directory that contains the information you don't want to be seen. When a user such as yourself enters the URL to the specific directory that you speak of, a username and password dialog box will pop-up asking for the crudentials required to proceed. You will also need a .htpasswd file that should be located in a different directory (preferably at the root of your website) and then referenced by the .htacces file so that when it is called upon it has these crudentials to verify that your the correct user to access the directory.

Its the same idea with any login form except the information is stored in a file on the server rather than having to parse a database table to find it.
 
Mmmm......good question...probably pay a monthly fee to a site like godaddy.com or something....
 
Back
Top