Login system php

Asked

Viewed 59 times

2

Hello,

I am creating a site with login system in php, and I have the following problem,

When I enter Login it does not check in the database if the information exists.

I wish I knew what mistake I’m making.

Follows the Code:

<p>
    <label for="email">E-mail:</label><br>
    <input required type="text" id="email" name="email" size="35">
</p>


<p>
    <label for="senha">Senha:</label><br>
    <input type="password" id="senha" name="senha" required>
</p>

 <input type="submit" value="enviar" name="enviar">

    if( empty($_POST["email"]) || empty($_POST["senha"]) ){
        echo "Digite o Login";
    }else {
        $email = $_POST['email'];
        $senha = $_POST['senha'];

        // Verificando se o usuário/e-mail existe no sistema
        $usuarios = buscaUsuario($conexao, $email);



        // Processo de login
                if( password_verify($senha, $usuarios['senha']) ){
                entrar($usuarios['id'],$usuarios['email'],$usuarios['senha']);
                header("location:posts.php");
            } else {
            echo "Login não encontrado";
            }   
    }       
    }    

  • I could describe more exactly what it would be "it does not check in the database if the information exists"? Already debugged the code to check if the data received in PHP are correct and in which if/elseis passing by?

  • I’m not sure, but if I’m not mistaken, it will only work if the inputs are inside a form with a action= preparing for a PHP and specifying the method="Post" in your case...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.