Good afternoon, I did a schedule to check if the login data is wrong or not, when I put the wrong data it gives me a alert
saying that the login or password is incorrect but when I click ok It looks like another alert
saying that I logged in successfully and going to another page ... what's happening?
code:
<html>
<head>
<script src="../js/angular.min.js"></script>
<script src="../js/jqueryAtualizado.js"></script>
<script src="../js/jqueryAtualizado.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script></head><body><?phpinclude("conexao.php");
if(isset($_POST['senha']) && strlen($_POST['login']) > 0){
if(!isset($_SESSION))
session_start();
$_SESSION['login'] = $link -> escape_string($_POST['login']);
$_SESSION['senha'] = $_POST['senha'];
$sql_code = "SELECT senha, codigo FROM usuario WHERE login = '$_SESSION[login]'";
$sql_query = $link -> query($sql_code) or die ($link -> error);
$dado = $sql_query->fetch_assoc();
$total = $sql_query-> num_rows;
if($total == 0){
echo "<script>alert('Login ou a senha estão errados.');</script>";
}
else{
if($dado['senha'] == $_SESSION['senha']){
$_SESSION['usuario'] = $dado['login'];
}
}
if(count($total) != 0){
echo "<script>alert('Login efetuado com sucesso.'); location.href='../Adm/AdmAgenda.php';</script>";
}
}
?>
</body>
</html>
Thank you ...