I'm making a site with a login thing. The usernames/passwords will be stored in the website files as .txt. (I know it's not safe. This isn't meant to be safe. It's a test to see if people can crack one of the passwords). Here is the current code:
var attempt = 3;
function validate(){
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if ( username == "username" || username == "Username" && password == "B6YC98"){
window.location = "success.html";
return false;
}
else{
attempt --;
alert("You have "+attempt+" attempt(s) left;");
if( attempt == 0){
document.getElementById("username").disabled = true;
document.getElementById("password").disabled = true;
document.getElementById("submit").disabled = true;
return false;
}
}
}
How would I make it so it checks if the username you entered, is equal to a username from usernames.txt? And the same for the passwords.