PDA

View Full Version : Password Protection code



bighurt35
01-04-2006, 07:13 PM
I was wondering I have this picture on my web site and i have a small box link inside of it. You can't see it but its there so i was trying to get a pop up password box when you clicked it. So you would click the right spot on the page and then it would pop up and say username and password. then u would enter it and the box would dissapear and the main page would change. Does anyone know how to make this code or show me how/where to get it :D thanx
does anyone actually know the code or do i have to pay for it.?


***
if anyone knows how to do this does anyone know how to have like a multi user code so that when lets say mr.A signs in he goes to a certain page and then when MR.B signs in under a different username he goes to a different page than MR. A.???? anyone know what im talking about..
****

Twey
01-05-2006, 05:18 PM
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."


<!-- 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.