PHP |找不到404对象

时间:2018-05-31 12:14:37

标签: php http-status-code-404

我的网站有问题。它应该有一个登录/注册网站。如果我输入我的名字和姓氏,密码等,我点击提交和404找不到对象。文件在正确的目录...顺便说一下,我还没有使用htaccess文件,所以你不需要要求它。

为我的基础英语而烦恼:)

`

if (isset($POST_['submit'])) 
include_once 'dbh.inc.php';

$first = mysqli_real_escape_string($conn, $_POST['first']);
$last = mysqli_real_escape_string($conn, $_POST['last']);
$email = mysqli_real_escape_string($conn, $_POST['email']);
$uid = mysqli_real_escape_string($conn, $_POST['uid']);
$pwd = mysqli_real_escape_string($conn, $_POST['pwd']);

//error handler
//Check for empty fields
if (empty($first) || empty($last) || empty($email) || empty($uid) || empty($pwd)) {
    header("Location: ../signup.php?signup=empty")
    exit();
} else {
    //Check if inputs are valid
    if (!preg_match("/^[a-zA-Z]*$/", $first) || !preg_match("/^[a-zA-Z]*$/", $first) ) {
        header("Location: ../signup.php?signup=invalid")
        exit();
    } else {
        //check if email is valid
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            header("Location: ../signup.php?signup=email")
            exit();
        } else {
            $sql = "SELECT * FROM users WHERE user_id='$uid'";
            $result =  mysqli_query($conn, $sql);
            $resultCheck = mysqli_num_rows($results);

            if ($resultCheck > 0) {
                header("Location: ../signup.php?signup=usernametaken")
                exit();
        } else { 
            //hashing passwords
            $hashedPwd = password_hash($pwd, PASSWORD_DEFAULT);
            //Insert the user into DB
            $sql = "INSER INTO users (user_first, user_last, user_email, user_uid, user_pwd) VALUES ('$first', '$
            last', '$email', '$uid', '$hashedPwd');";
        $result = mysqli_query($conn, $sql);
        header("Location: ../signup.php?signup=succes")
                exit();
        }
    }   
}



} else {
header("Location: ../signup.php")
exit();
}`

1 个答案:

答案 0 :(得分:1)

据我所知,你不能使用' ..'标题中的表示法('位置:')。浏览者不明白' ..'符号。

您应该使用完全限定的URL或相对URL:

http://www.fluid-converter.com/