1 Javascript - Login protection Fri May 25, 2012 12:36 am
Mr.Joker
Mr. WebArtz
Hello WebArtz members, I am Mr.Joker and in this tutorial I will teach you how to protect your login username and password. You allready know that people can view your source code and like that simply see username and password and login which is bad. So there is a way to protect it but its not that taff. Still, if someone know javascript he can brake this code so simple. Here is code:
If you have any questions ask me .
- Code:
<html>
<head>
<title>Javascript - Forms</title>
<script type="text/javascript">
function test() {
var userName = document.forms[0].elements[0].value;
var password = document.forms[0].elements[1].value;
var x = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
var combination = x[19] + x[4] + x[18] + x[19] ;
var combination1 = x[0] + x[2] + x[0];
if ((userName==combination) && (password==combination1)) {
alert("Its true");
}
}
</script>
</head>
<body>
<form>
Username:<input type="text" />
Password:<input type="text" />
<input type="button" value="Click me" onClick="test();" />
</form>
</body>
</html>
If you have any questions ask me .