-2
I want to know a code that when the person clicks on an OK button to log in a warning: "You are logged in!". If a warning does not appear: "You are not in the system, enter your Access information correctly!".
You could help me?
-2
I want to know a code that when the person clicks on an OK button to log in a warning: "You are logged in!". If a warning does not appear: "You are not in the system, enter your Access information correctly!".
You could help me?
0
This is very relative, there are several ways to do this, it depends on what you are using, if there is a database with the login and password of users or if you want to use only JS, jQuery to do this.
Here is a basic example of warning whether the person has logged in or not, using the data name = name123 and password = password123, you can see the result:
<!DOCTYPE html>
<html>
<head>
<title>teste</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<style>
#situacao{
width:140px;
height:70px;
display: flex;
justify-content: center;
align-items: center;
margin-top: 40px;
font-size: 16px;
}
.logado{
background-color: #65ff00;
}
.nLogado{
background-color: #cc1212;
}
</style>
</head>
<body>
<label> Nome: </label>
<input type="text" name="nome" id="nome">
<br>
<label> Senha: </label>
<input type="password" name="senha" id="senha">
<br>
<input type="submit" name="enviar" id="enviar" value="Logar">
<div id="situacao"></div>
<script>
nome = "nome123";
senha = "senha123";
$("#enviar").click(function(){
nomeDigitado = $("#nome").val();
senhaDigitada = $("#senha").val();
if(nomeDigitado == nome && senhaDigitada == senha){
alert("Você está logado!");
$("#situacao").html("Login com sucesso").addClass("logado");
} else {
alert("Você não esta no sistema, digite corretamente suas informações de Acesso!");
$("#situacao").html("Login sem sucesso").addClass("nLogado");
}
});
</script>
</body>
</html>
That’s right! Only with database. Cool, I got a basic idea. I’m just Webdesigner, I know the basics of JS. but I will create a system with the help of other back-end devs. vlw! :)
Browser other questions tagged php javascript jquery sql
You are not signed in. Login or sign up in order to post.
Welcome. What have you tried to do? You could ask the question so we can evaluate and help you better?
– Wallace Maxters
This can be done with Javascript, jQuery, in conjunction with visual plugins like sweetalert2 or just Css. Search right here on the site you probably found material.
– LeAndrade