»
EnglishFrenchVietnamese

Print - Enhanced Login Javascript Test - JavaScriptBank.com

Full version: jsB@nk » Security » Passwordor » Enhanced Login Javascript Test
URL: https://www.javascriptbank.com/enhanced-login-javascript-test.html

Enhanced Login Javascript Test © JavaScriptBank.comThis is a simple password script that requires both a login and password to gain entry to the protected page, with an incorrect set taking the user to a 'failure' page instead. This script uses Array to keep data of users. And Usernames and passwords are case sensitive.

Full version: jsB@nk » Security » Passwordor » Enhanced Login Javascript Test
URL: https://www.javascriptbank.com/enhanced-login-javascript-test.html



JavaScript
<script language="javascript"> // called by the current pagelook=new Array(new Array("user01","pass01"),new Array("user01","pass02"));</script><script language="javascript"><!--function go(){var user = document.form.user.value;var pass = document.form.pass.value;if ( user == "" && pass == "" ){ alert("Invalid Username or Password!"); // Put your own message here}else { isfound=false;okpass=""for (i = 0; i < look.length; i++){ if (user==look[i][0]){ okpass=look[i][1];isfound=true;break; }}if (okpass==""){ alert("Invalid Username or Password!"); // Put your own message here }else { if (!isfound) { alert("Invalid Username or Password!"); // Put your own message here }else { if (okpass != pass) { alert("Invalid Username or Password!"); // Put your own message here} else { location = user.toLowerCase() + "/" + pass.toLowerCase() + ".html"; //YOU MUST HAVE A FOLDER THAT CONFORMS TO THE USERNAME ENTRY!!}}}}}//--></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
Use &quot;user01&quot; as user name and &quot;pass01&quot; as password, or &quot;user02&quot; and &quot;pass02&quot;. Try putting in something else and see!<p>Usernames and passwords are case sensitive! Lower case only!!</p><form name="form"><font face="verdana"><table border="0"><tbody><tr><td><font face="verdana">Username:</font></td><td><input type="text" name="user" size="15"></td></tr><tr><td><font face="verdana">Password:</font></td><td><input type="password" name="pass" size="15"></td></tr><tr><td></td><td align="center"><input type="button" value="Login" name="login" onclick="go()"><input type="reset" value="Reset"></td></tr></tbody></table></font></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->