我在登录和电子邮件确认码方面遇到同样的错误

时间:2017-04-30 08:23:56

标签: php email login

可以告诉我这段代码有什么问题

enter image description here

 <?php if(isset($_SESSION['confirmation_success'])); ?>
               <div class="alert alert-success"> <?php echo $_SESSION['confirmation_success']; ?></div>
                <?php unset($_SESSION['confirmation_success']); ?>

上面的代码是login.php第16行

function user_login(){
GLOBAL $db;
    if(isset($_POST['login'])){
    $email      = trim($_POST['email']);
    $password   = trim($_POST['password']);
        if(empty($email) || empty($password)){
            echo "<div class = 'alert alert-danger'> please enter email and password</div>";
        }else{
            $Query = $db->prepare("SELECT * FROM users WHERE email = ?");
            $Query->execute([$email]);
                if($Query->rowCount() == 1){
                    $row = $Query->fetch(PDO::FETCH_OBJ);
                    $id = $row->$id;
                    $db_password = $row->password;
                    $status = $row->status;
                        if($status == 0){
                            $_SESSION['user_email'] = $email;
                            $_SESSION['please_confrim'] = "please confirm your email....";
                            header("Location:confirm.php");
                        }else{
                            if(password_verify($password, $db_password)){
                                $_SESSION['user_id'] = $id;
                                header("Location:profile.php");
                            }else{
                                echo "<div class='alert alert-danger'>please enter correct password</div>";
                            }
                        }
                }else{
                    echo "<div class ='alert alert-danger'>Please Enter Correct Email</div>";

                }
        }
    }
}

上面的代码是function.php可以帮助我

0 个答案:

没有答案