I am having issues with my HTML code. I want to protect a page with password/ username.?

I am having issues with my html code. I have looked it over a million plus two times and can not figure what I am doing wrong. I am not too worried about it being too secure. Can anyone help me figure this out? Here is my code as of right now.... <html> <head> <title>Rep. Login Page</title> </head> <body> <center> <img src="cblogin.jpg"></img> <p><font color="#CC66CC" size="5" face="Perpetua"><strong>Sales Reps Only</strong></font></p> <font size="3" face="Perpetua"> <script type="text/javascript"> 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==Ashley&&passcode==1234) { window.location="cbreps.html"} else{ alert("password/username combination wrong")} } if(usercode==Emma&&passcode==2345) { window.location="cbreps.html"} else{ alert("password/username combination wrong")} } if(usercode==Sam&&passcode==3456) { window.location="cbreps.html"} else{ alert("password/username combination wrong")} } </script> <form name="password1"> <p><strong><font color="#666666">Username: </font></strong> <font color="#666666"> <input type="text" name="username2" size="15"> <br> <strong>Password: </strong> <input type="password" name="password2" size="15"> </font></p> <p> <font color="#666666"> <input type="button" value="Submit" onClick="submitentry()"> </font></p> </form> <p align="center"></p> <p></p> <font face="Perpetua" size="3">If you are having problems logging in click <a href="mailto:x@comcast.net">here</a> to report it.</font> <font size="3" face="Perpetua"><br> Click <a href="http://www.x.com">here</a> to return to main page.</font> </center> </body> </html> I don't need it to be secure at this point. I just need to get it working. I understand that everyone will be able to view the code but I have a deadline of next week so if I could just get it up and working now and then go back and secure it later on, that'd be great! Thanks for your help!

Public Comments

  1. before I look through your code, do you understand that this is not any way to secure your website? The Usernames and Passwords are right there in the source code for everyone to see. Since javascript is client side code, anyone who knows how to right click can figure out how to get into your site.
  2. There is a few errors i found as following 1. there is an extra } after all alert("password/username combination wrong") 2. there is a missing } before </script> 3. usercode is supposed to be numerics but later changed to people names, don't know if those names are variables(that not set yet) or String to compare 4. 3 sets of Conditional clause "if" so for every log in you got 3 responses, try to use switch or reorganize the "if" to use with "else if" to produce 1 response.
Powered by Yahoo! Answers