I have a problem with my username and password for "login successfully" which is not connecting to database i dont know how to code it.. like getting username and password from database for the login authentication.. Here is my javascript code .....
var attempt = 3;
function userLogin(){
var username = document.getElementById("username").value;
var password = document.getElementById("password1").value;
if(username=="" || password==""){
alert ("Please complete the required field!");
}if(username==username || password==password){
alert ("Login Successfully");
}else{
attempt --;
document.getElementById("msg").innerHTML="<center class='text-danger'>Invalid username or password</center>";
alert("You have left "+attempt+" login attempt;");
if(attempt == 0){
document.getElementById("username").disabled=true;
document.getElementById("password1").disabled=true;
document.getElementById("login").disabled=true;
}
}
}
I want to get the username and password from the Mysql database for my login (login successfully).. Like for example.. entering the username and password from database then if correct it will alert login successfully then after going to the landing page.. else if not from the database it will attempt 3 times just like my code here..