PDA

View Full Version : Password Protection



Delta88
01-28-2008, 03:48 PM
1) Script Title: Encrypted Password script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex9/password.htm

3) Describe problem:
I was wondering how I could change it to one field, as I dont need a username just a pssword field.

thetestingsite
01-28-2008, 05:41 PM
Here you go:



<script type="text/javascript">
//Encrypted Password script- By Rob Heslop
//Script featured on Dynamic Drive
//Visit http://www.dynamicdrive.com

function submitentry(){
password = document.password1.password2.value.toLowerCase()
passcode = 1

for(i = 0; i < password.length; i++) {
passcode *= password.charCodeAt(i);
}

//CHANGE THE NUMBERS BELOW TO REFLECT YOUR PASSWORD
if(passcode==126906300)
//CHANGE THE NUMBERS ABOVE TO REFLECT YOUR PASSWORD
{
window.location=password+".htm"}
else{
alert("password incorrect")}
}
</script>

<form name="password1">
<strong>Enter password: </strong>
<input type="password" name="password2" size="15">
<input type="button" value="Submit" onClick="submitentry()">
</form>


Hope this helps.

Delta88
01-28-2008, 06:44 PM
Thank you very much Ill try it out and get back to you.

Delta88
01-29-2008, 09:45 AM
Hi I have tried this and it doesnt work has anyone else got any ideas or know of another script that might work.

codeexploiter
01-29-2008, 10:20 AM
The script works well with a single field as thetestingsite furnished but you need to do the following things to make this script run:

1. First you need to calculate the encrypted value of your password (step 1 mentioned in the script page).

2. Copy that value and paste that value in the JS code in the following manner:


if(passcode==your_encrypted_value_goes_here)


3. Next thing you need to have a page whose name is equivalent to your original password (not the encrypted value) and according to the script this file extension is .htm. If you want to open a file with another extension then you need to change the following line:

window.location=password+".htm"

4. Last but not the least the name of your form and the password field should be password1 and password2 respectively

.htm can be replaced with your file name extension.

If you follow these items then the script should work without any problems.