错误消息不会显示?

时间:2019-05-31 11:07:58

标签: php mysql login message

我为学校项目制作了完整的登录系统。在登录的注册部分,您需要填写您的名字和姓氏,地址,电子邮件等。在创建帐户之前,将先验证电子邮件和名称。但是,当用户输入错误的电子邮件时,我的错误消息不会出现吗?有人可以帮我吗?

谢谢!

PHP代码(以注册形式键入):

<?php
    $fullUrl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

    if(strpos($fullUrl, "signup=empty") == true){
        echo"<p class='error'>Please fill in all fields!<p>";
        exit();
    } elseif(strpos($fullUrl, "signup=char") == true) {
        echo"<p class='error'>Only use letters! 
    <p>";
        exit();
    } elseif(strpos($fullUrl, "signup=email") == true) {
        echo"<p class='error'>Please fill in a valid e-mailaddress<p>";
        exit();
    }
?>

我在其中检查数据的PHP代码:

if(empty($firstname) || empty($lastname) || empty($address) || empty($tel) || empty($email) || empty($password)){
    header("Location: ../GIP2018/login.php?signup=empty");
    exit();
} else {
    if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
        header("Location: ../GIP2018/login.php?signup=email");
    } else {
        if(!preg_match("/^[a-zAa-Z]*$/", $firstname) || !preg_match("/^[a-zAa-Z]*$/", $firstname)){
            header("Location: ../GIP2018/login.php?signup=char");
        } else {
            $password = md5($password);

            $query = "INSERT INTO users (vrnaam, arnaam, adres, tel, email, password) 
                      VALUES('$firstname', '$lastname', '$address', '$tel', '$email', '$password')";

            mysqli_query($db, $query);
            $_SESSION['vrnaam'] = $firstname;
            $_SESSION['success'] = "You are now logged in";

            header('location: index_afterlogin.html');
        }
    }
    }
}
?>

0 个答案:

没有答案