首页 > 解决方案 > 未定义索引:密码即使我用过 isset

问题描述

在提出这个问题之前请稍候,因为从我所看到的情况来看,我尝试了大多数答案中显示的所有技术,但它没有奏效。拜托,我已经解决这个错误好几天了,并尝试了一切,让我们一起努力寻找解决办法!如果您需要任何其他代码或详细信息,请在评论中询问。谢谢

出现此错误:

在此处输入图像描述

这是我的 login.php:

<?php

if (isset($_POST['email']) || isset($_POST['password']))
{   
    require_once 'connect.php';
    $email = $mysqli->escape_string($_POST['email']);
    $password = $mysqli->escape_string($_POST['password']);
    $result = $mysqli->query("SELECT * FROM users WHERE email='$email'");

    if ($result->num_rows == 0){
        echo "Did not find any user with this email.";
        exit();
    }
    else {
        $user = $result->fetch_assoc();
        //LINE 16//if (password_verify($password, $user['password'])){**
            $_SESSION['id'] = $user['id'];
            $_SESSION['email'] = $user['email'];
            echo "Success.";
        }else{
            echo "Wrong Password";
            die();
    }
}
} 

?>

这是我的 login_page.php:

<?php require_once 'header.php' ?>

<center>
    <h1 class='pageTitle'>Login</h1>
    <a href="register_page.php" class='registerLink'> Or Register</a><br>
    <form action="login.php" method="post">
        <input type="text" name="email" placeholder="Email"> <br>
        <input type="password" name="password" placeholder="Password"><br>
        <input type="submit" value="Submit">
    </form>
</center>

<?php require_once 'footer.php' ?>

标签: phpsql

解决方案


推荐阅读