|
Password Protection
Welcome to this issues Java Junky. Anyway, today I'm going to talk
about simple password protections using java. I have included the
full source code too at the bottom.
The java script I am using was created by Animorph840. Thanks for
the script! All you need to do is put the script in your <body>…</body>
tags.
The script presents you with a simple form to put the password
in and if you are correct you are taken to page2.htm. If not you
are taken to wrongpage.htm and eaten :). You can also add multiple
passwords.
<SCRIPT Language = "JavaScript">
function passwordOK(anystring) {
anystring = anystring.toUpperCase()
if (anystring == "GREEN" || anystring ==
"BLUE" || anystring
== "RED" || anystring == "YELLOW") {
/*Add more passwords if you'd like, but ALL PASSWORDS MUST BE IN
CAPS!*/
alert('You got it right!')
alert('Now taking you to the hidden page.')
location="page2.htm"
//Change page2.htm to your hidden page
}
else {
alert ("Please enter the CORRECT password next time.")
location="wrongpage.htm"
/*substitute your own wrong page for wrongpage.htm*/
}
}
</SCRIPT>
<FORM>
<b>Password: </b>
<INPUT type="password" name='pass' Size = 20 onChange
=
"passwordOK(this.value)">
</FORM>
<FORM>
<b>Password: </b>
<INPUT type="password" name='pass' Size = 20 onChange
=
"passwordOK(this.value)">
<!-----Password_Script_By_Animorph840_animorph840@yahoo.com----->
<!--From_Animorph840's_Galaxy__http://www.angelfire.com/ky/Animorph840-->
</FORM>
|