Thursday, January 28, 2016

How to set Password for Google

In this tutorial we are going to learn how to disable text box in 3 failure login attempts. The user is only given 3 chances to enter the correct username and password. Once is correct it will redirect to google index page
Username: test
Password: test
You can modify the username and password inside the script.
You need internet connection for this




<!DOCTYPE html>
<html>
<head>
<style>
table{ 
      margin:auto;
    }
input{
      border:1px solid #888;
      padding:5px;
    }
</style>
</head>
<body>
<script type = "text/javascript">

var count = 2;
function validate() {
var un = document.myform.username.value;
var pw = document.myform.pword.value;
var valid = false;

var unArray = ["admin", "test", "sample"];  
var pwArray = ["admin", "test", "sample"]; 

for (var i=0; i <unArray.length; i++) {
if ((un == unArray[i]) && (pw == pwArray[i])) {
valid = true;
break;
}
}

if (valid) {
alert ("Login Successfully!");
window.location = "http://www.google.com";
return false;
}

var t = " tries";
if (count == 1) {t = " try"}

if (count >= 1) {
alert ("Invalid Username or Password.  You have " + count + t + " left.");
document.myform.username.value = "";
document.myform.pword.value = "";
setTimeout("document.myform.username.focus()", 25);
setTimeout("document.myform.username.select()", 25);
count --;
}

else {
alert ("Still incorrect! You have no more tries left!");
document.myform.username.value = "No more tries allowed!";
document.myform.pword.value = "";
document.myform.username.disabled = true;
document.myform.pword.disabled = true;
return false;
}

}

</script>
<br><br><br><br>
<br><br><br><br>
<br><br>
<table cellpadding="5">
<form name = "myform">
<tr>
<td><label>Username: </label></td><td> <input type="text" name="username"></td>
</tr>
<tr>
<td><label>Password: </label></td><td> <input type="password" name="pword"></td>
</tr>
<tr>
<td></td><td><input type="button" value="Log In" name="Submit" onclick= "validate()"></td>
</tr>
</form>
</table>
</body>

</html>


Share this

0 Comment to "How to set Password for Google"

Post a Comment