我收到一个解析错误:语法错误,意外的';'我似乎无法解决它

时间:2019-05-01 02:12:14

标签: php mysql phpmyadmin

我正在创建登录系统,但是我的代码最终向我发送此错误:解析错误:语法错误,意外的';'在第12行的C:\ xampp \ htdocs \ something \ includes \ signup.php中

<?php
 if (isset($_POST['signup-submit'])) {

require 'dbh.php';

$username = $_POST['uid'];
$email = $_POST['mail'];
$password = $_POST['pwd'];
$passwordRepeat = $_POST['pwd-repeat'];

if (empty($username) || (empty($email) || (empty($password) || (empty($passwordRepeat)) {
    header("Location: ../signup.php?error=emptyfields&uid=".$username."&mail=".$email);
    exit();
}
else if (!filter_var($email, FILTER_VALIDATE_EMAIL) && !preg_match("/^[a-zA-Z0-9]*$/",
    $username) );
    header("Location: ../signup.php?error=invalidmailuid");
    exit();  
{

}
else if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
 header("Location: ../signup.php?error=invalidmail&uid=".$username);
    exit(); 
}
else if (!preg_match("/^[a-zA-Z0-9]*$/", $username)) {
 header("Location: ../signup.php?error=invaliduid&mail=".$email);
    exit(); 
    }
    elseif ($password !== $passwordRepeat) {
     header("Location: ../signup.php?error=passwordcheckuid=".$username."&mail=".$email);
    exit(); 
    }
    else {

        $sql = "SELECT uidUsers FROM users WHERE uidUsers=?";
        $stmt = mysqli_stnt_init($conn);
        if (!mysqli_stmt_prepare($stmt, $sql)) {
            header("Location: ../signup.php?error=sqlerror");
    exit(); 
        }
        else{
            mysqli_stmt_param($stmt, "s", $username);   
            mysqli_stmt_execute($stmt);
            mysqli_stmt_store_result($stmt);
            $resultCheck = msqli_stmt_num_rows($stmt);
            if ($resultCheck > 0) {
    header("Location: ../signup.php?error=usertaken&mail=".$email);
    exit(); 
            }
            else{

            $sql = "INSERT INTO users (uidUsers, emailUsers, pwdUsers) VALUES (?, ?, ?)";
            $stmt = mysqli_stnt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {header("Location: ../signup.php?error=sqlerror");
    exit();
            }
            else{
                $hashhedPwd = password_hash($password, PASSWORD_DEFAULT)

            mysqli_stmt_param($stmt, "sss", $username, $email, $hashhedPwd);    
            mysqli_stmt_execute($stmt);
            header("Location: ../signup.php?signup=success");
            exit(); 
            }
          }
        }

    }
    mysqli_stmt_close($stmt);
    mysqli_close($conn);

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

应显示注册=成功并在数据库中注册。另外,我是PHP的新手,所以我希望在这里和那里出现一些错误。谢谢您的帮助!

0 个答案:

没有答案