Jump to content

erro login.php

Rúben Periquito Developer

Recommended Posts

onde está o erro neste login.php?





//grab values email and password from login form

$login_email = $_POST('login_email');
$login_password = $_POST('login_password');

//create the query and number of rows returned from the query

$query = mysqli_query($dbc, "SELECT * FROM users WHERE email='".$login_email."'");
$numrows = mysqli_num_rows($query);


//created condition to check if there is 1 row with that email

if ($numrows != 0) {

//grab the email and password from that row returned before
    while ($row = mysqli_fetch_array($query)) {

            $dbemail = $row['email'];
            $dbpass = $row['password'];


//create condition to check if email and password are equal to the returned row

        if ($login_email==$dbemail) {
            if ($login_password==$dbpass) {
                echo "You are in";
                echo "Your password is incorrect";
            echo "Your email is incorrect!";

echo "You are not registered. Please register bellow...";

    echo "Please Login...";

<html lang="en">

    <form method="post" action="login1.php">
        <p>Email<input type="text" name="login_email"></p>
        <p>Password<input type="password" name="login_password"></p>
        <p><input type="submit" name="Login"></p>

Edited by Rúben Periquito Developer

Rúben Periquito 

Link to comment
Share on other sites

Primeiro, o teu form está a fazer submir para o ficheiro login1.php (não sei o que lá está, mas se calhar era para o login.php).

Segundo, após validação de username/email e password, convem guardar em sessão/cookie que estás com login efectuado... Depois é validar se tens sessão/cookie, se tiveres mostras o que queres mostrar com login feito, se não mostra o nomal se login.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.