The first thing you have to understand that this is not, in any way, or under any circumstances, secure. The second is that you'll make your page dependent upon Javascript by using this. The third is that we'd be better modifying the "Encrypted Password Script."
Code:
<!-- This goes in the head. -->
<style type="text/css">
#passInput {
display: none;
}
#showPassInput {
position: absolute;
/* modify values as needed */
top: 50px;
left: 100px;
height: 50px;
width: 50px;
}
</style>
<script type="text/javascript">
//Encrypted Password script- By Rob Heslop
// Modified by Twey to hide input stuff
//Script featured on Dynamic Drive
//Visit http://www.dynamicdrive.com
function submitentry(){
password = document.password1.password2.value.toLowerCase()
username = document.password1.username2.value.toLowerCase()
passcode = 1
usercode = 1
for(i = 0; i < password.length; i++) {
passcode *= password.charCodeAt(i);
}
for(x = 0; x < username.length; x++) {
usercode *= username.charCodeAt(x);
}
//CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
if(
(usercode==134603040&&passcode==126906300)
|| (usercode==123950435&&passcode==249320958)
|| (usercode==123095343&&passcode==238432903)
// Add more user/password combinations here if you like, using the syntax shown above.
)
//CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
{
window.location=password+".htm"}
else{
alert("password/username combination wrong")}
}
</script>
<!-- This goes in the body -->
<div id="passInput">
<form name="password1">
<strong>Enter username: </strong>
<input type="text" name="username2" size="15">
<br>
<strong>Enter password: </strong>
<input type="password" name="password2" size="15">
<input type="button" value="Submit" onClick="submitentry()">
</form>
</div>
<div id="showPassInput" onclick="document.getElementById('passInput').style.display='block';">
</div>
Untested.
Bookmarks