Password Protection 2A script that is a little better
Warning: These scripts are not totally secure and your page can be seen if someone gets through. Do NOT protect anything important with a script like this. Try looking for a CGI Script or ask your web host to set up an .htpassword file if you need to protect something important.
Now that I have said that so boldly, let's take a look at how this version of the script works. Try out the example below:
A little better, I suppose. Let's take a look at the code you will need:
1) You will need to place a link to the intermediate page on one of your pages. In my example, the intermediate page is "jex10.htm". I put the link on this page, "jpass2.htm". Example below:
<BODY> <A HREF="jex10.htm">Click to Enter</A> </BODY>
2) Now you need to create your intermediate page. In my case, this is "jex10.htm". You will need the following script on this page:
This intermediate page is what does all the work. As you can see, if the password is correct, it takes the user to the protected page. In the example, the protected page was "jex11.htm". You can replace that with the url of the page you wish to protect.
If the password is incorrect, the user gets sent back to the page that contains your link to the intermediate page. In my case, that is the very page you are looking at, "jpass2.htm".
Well, give it a try and see if it works better for you. Have fun!
Ready for a new subject? Well, then go to the next section: Confirmation Boxes.
||By: John Pollock||