Simple password script

It is not secure, there is no encryption, but it can come in handy and will work on any machine. The best thing to do is call it up in a .js file. Below is the script, and what you would put in the head, assuming you used a .js file. Put the file in your cgi-bin, and called it "pwd.js". CHMOD on the .js file should be 755.



The code below goes into the head of an "entrance" page that will call up the script.


<HEAD>
<Script Language="JavaScript SRC="cgi-bin/pwd.js"></Script>
</HEAD>

The following would go into the separate .js file, stored in the cgi-bin. Note the password (please).
Just set the password, success page, and failed page to what you want.

var password = prompt("Please Enter Password");
if (password.toLowerCase() == "please") {
alert("Password Correct \n \n Please Enter");
location = "/success.html";
}
else {
location = "failed..html";
}

If you used a .js file, the code immediately above would be the entire .js file.

Back