1
Good afternoon, I am developing a login system, that if the user enters the password or incorrect email, appears in a modal window that the data does not match the typed, but when the password or email are incorrectly typed, the modal window is not opening, causing the user to press the button to open it... But this message appears, I wonder how I can make the modal window can open..?
HTML:
<div class="modal-body text-md-center">
<form method="post" action="valida.php">
<div class="form-row">
<div class="form-group">
<input type="email" class="form-control" name="email" id="email" placeholder="Email:">
<input type="password" class="form-control" id="senha" name="senha" placeholder="Senha:">
<br>
</div>
</div>
<input type="submit" name="btnLogin" value="Entrar" class="btn btn-outline-warning"><br><br>
<?php
if(isset($_SESSION['msg'])){
echo $_SESSION['msg'];
}
?>
<p class="text-center">
Caso não possuir conta, <a href="#cadastrouser" data-toggle="modal" data-target="#modalSelecionar" data-dismiss="modal">cadastre-se</a>
</p>
</form>
</div>
PHP:
<?php
include("conexao.php");
$email = $_POST['email'];
$senha = $_POST['senha'];
/* Verifica se existe usuario, o segredo ta aqui quando ele procupa uma
linha q contenha o login e a senha digitada */
$sql_logar = "SELECT * FROM aluno WHERE email = '$email' && senha = '$senha'";
$exe_logar = mysqli_query($conection, $sql_logar) or die (mysqli_error());
$fet_logar = mysqli_fetch_assoc($exe_logar);
$num_logar = mysqli_num_rows($exe_logar);
//Verifica se n existe uma linha com o login e a senha digitado
if ($num_logar == 0){
session_start();
$_SESSION['msg'] = "<div class='alert alert-danger'>Login ou senha incorreto!</div>";
header("Location: index.php?login");
}
else{
//Cria a sessão e manda pra pagina principal.php
session_start();
$_SESSION['email'] = $email;
$_SESSION['senha'] = $senha;
header("Location:aluno.php");
}
?>
If anyone has an idea of what can be done, and can help, I will be grateful!
That one
?login
in the URL ofindex.php
is to identify which password or email was entered wrong?– Sam
No, this ? login directs when the user type wrong.. So when ? login appears I want it to be with the modal open..
– Matheus
Is this modal bootstrap? 3 or 4?
– Sam