I designed a web page for our Home Owners Association. One requirement was to password protect access. I found a simple script that worked on my computer and a friend’s computer. However, it didn’t work on my wife’s computer (all three PC -no apple). When I tried to click on the button to enter the “protected area” by entering a password, her computer closed the webpage and returned to her homepage. I’m stumped on how to ensure all HOA members will have the ability to get past the login page. Ideas? I’m happy to submit the script if needed.
Unfortunately that won’t keep anyone who wants to snoop around from doing so if they decide to look at your code in their browser which you can’t stop anyone from doing.
If they look at your code they will see the correct password to enter.
Also, if a user has javascript turned off in their browser your security is totally disabled because it uses javascript.
This should really be done server side using a language like PHP, ASP, JSP or similar.
Just an FYI - this is about as secure as leaving a key to your house under the doormat. Any non-member that knows how to view the source of a web page will be able to access the protected area.
If your web server supports PHP you will be able to find a free script to protect that page and will do much better at keeping the snoopers out.
to do this securely you will need a server side language to handle to handle the password protection. What server side language do you have access to on your web server?
Thanks for the quick reply. I am a newby at web design (dumb as a box of rocks), so I don’t know what server side language is available. I use ipage if that helps any. I have copied the password script below
function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password',' ');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == "letmein") {
alert('You Got it Right!');
window.open('protectpage.html');
break;
}
testV+=1;
var pass1 =
prompt('Access Denied - Password Incorrect, Please Try Again.','Password');
}
if (pass1.toLowerCase()!="password" & testV ==3)
history.go(-1);
return " ";
}
</script>
<center>
<form>
<input value="Enter Protected Area" onclick="passWord()" type="button">
</form>
</center></body></html>
The security doesn’t have to be space-age stuff. We’re just trying to keep non-members from snooping.