akdream
02-25-2010, 11:07 PM
1) Script Title: Encrypted password script
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex9/password.htm
3) Describe problem: I slightly changed the code of the above script to allow me to post multiple passwords. That's the code:
<script>
//Encrypted Password script- By Rob Heslop
//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);
}
if(usercode == "14048027910" && passcode == "14048027910"){
window.open('/test/'+'username2'+'.html','_blank');
}
else if(usercode == "14048027910" && passcode == "14048027910"){
window.open(/test/password+'.html','_blank');
}
else if(usercode == "14048027910" && passcode == "14048027910"){
window.location.href = "Cat_main.html";
}
else{
window.location.href = "error.html";
}
}
</script>
<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>
14048027910 = mario (used for username and password)
I have no problem with the multiple usernames and password (I guess).
The problem is with the URL you get redirected to (here in blue) when entering the information into the form.
I would like the URL to be
/test/(what you type in as username in the form here in green).html
But I can't figure out how to get the username value you type in the form to be part of the URL for it to be
/test/USERNAME.html
Can anybody help me out on this?
Thank you,
Tim
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex9/password.htm
3) Describe problem: I slightly changed the code of the above script to allow me to post multiple passwords. That's the code:
<script>
//Encrypted Password script- By Rob Heslop
//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);
}
if(usercode == "14048027910" && passcode == "14048027910"){
window.open('/test/'+'username2'+'.html','_blank');
}
else if(usercode == "14048027910" && passcode == "14048027910"){
window.open(/test/password+'.html','_blank');
}
else if(usercode == "14048027910" && passcode == "14048027910"){
window.location.href = "Cat_main.html";
}
else{
window.location.href = "error.html";
}
}
</script>
<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>
14048027910 = mario (used for username and password)
I have no problem with the multiple usernames and password (I guess).
The problem is with the URL you get redirected to (here in blue) when entering the information into the form.
I would like the URL to be
/test/(what you type in as username in the form here in green).html
But I can't figure out how to get the username value you type in the form to be part of the URL for it to be
/test/USERNAME.html
Can anybody help me out on this?
Thank you,
Tim