Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 尝试验证所有字段是否有用户输入 sec_session_start(); error_reporting(E_ALL); ini_set('display_errors', 1); $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = ''; $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = ''; if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) { if($_POST['name2'] == "") { $emptyErr = 'Please fill in all the Fields'; $_SESSION['emptyErr'] = $emptyErr; header('location: ../join.php'); echo $emptyErr; echo 'emptyform'; die(); } }else{ $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING); // Sanitize the data passed in 'email' $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL); // validate the data passed in 'email' $email = filter_var($email, FILTER_VALIDATE_EMAIL); // check if email is valid if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { // Not a valid email $emailErr = "The email address you entered is not valid"; } //Sanitize the data passed in 'password' $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING); //validate the data passed in 'password' if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) { } else { $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the form!"; } //Sanitize the data passed in 'confirm_password' $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING); //check that password and confirm password match if ($password != $confirm_password) { // error matching passwords $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully."; } // if($name == '' && $email == '' && $password == '' && $confirm_password = '') { // $emptyErr - 'Please fill in all the Fields'; // $_SESSION['emptyErr'] = $emptyErr; //// header('location: ../join.php'); //echo $emptyErr; // die(); // }else{ // } $hash = password_hash($password, PASSWORD_DEFAULT); } //echo 'test8'; //echo '<br>'; $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')"); $results = mysqli_query($mysqli, $query); while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){ //echo 'test4'; //echo '<br>'; $db_id = $row['id']; $db_name = $row['name']; $db_email = $row['email']; $db_password = $row['password']; } //echo $db_id; //echo '<br>'; //echo $db_name; //echo '<br>'; //echo $db_email; //echo '<br>'; //echo $db_password; //check if user exsists, if confirmed go to the login page so user can login. if ($db_name === $name && $db_email === $email){ $regErr = 'User Already Exsists!<br>Please Login'; $_SESSION['regErr'] = $regErr; //header('location: ../login.php'); echo $regErr; die(); }else //echo $name; //echo $db_id; if($db_name === $name && $db_email !== $email){ echo 'test4'; $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!'; //echo $name_existErr; } //echo $db_id; //echo '<br>'; //echo $db_name; //echo '<br>'; //echo $db_email; //echo '<br>'; //echo $db_password; if($db_email === $email && $db_name !== $name){ $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!'; //echo $email_existErr; } if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){ //if all valid and no errors, register new user to the database. $_SESSION['email'] = $email; $_SESSION['hash'] = $hash; $_SESSION['name'] = $name; echo 'no errors'; // header('location: register_user.inc.php'); }else{ //if validation shows errors go back to join form. // $_SESSION['emptyErr'] = $emptyErr; $_SESSION['email_existErr'] = $email_existErr; $_SESSION['name_existErr'] = $name_existErr; $_SESSION['emailErr'] = $emailErr; $_SESSION['passwordErr'] = $passwordErr; $_SESSION['confirm_passwordErr'] = $confirm_passwordErr; echo $email_existErr; echo '<br>'; echo $name_existErr; echo '<br>'; echo $confirm_passwordErr; echo '<br>'; echo $emailErr; echo '<br>'; echo $password_matchErr; echo '<br>'; echo $passwordErr; //header('Location: ../join.php'); } //echo $name; //echo $email; //echo $confirm_password; //echo $password; //echo $hash; ?>_Javascript_Php_Forms_Validation - Fatal编程技术网

Javascript 尝试验证所有字段是否有用户输入 sec_session_start(); error_reporting(E_ALL); ini_set('display_errors', 1); $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = ''; $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = ''; if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) { if($_POST['name2'] == "") { $emptyErr = 'Please fill in all the Fields'; $_SESSION['emptyErr'] = $emptyErr; header('location: ../join.php'); echo $emptyErr; echo 'emptyform'; die(); } }else{ $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING); // Sanitize the data passed in 'email' $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL); // validate the data passed in 'email' $email = filter_var($email, FILTER_VALIDATE_EMAIL); // check if email is valid if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { // Not a valid email $emailErr = "The email address you entered is not valid"; } //Sanitize the data passed in 'password' $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING); //validate the data passed in 'password' if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) { } else { $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the form!"; } //Sanitize the data passed in 'confirm_password' $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING); //check that password and confirm password match if ($password != $confirm_password) { // error matching passwords $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully."; } // if($name == '' && $email == '' && $password == '' && $confirm_password = '') { // $emptyErr - 'Please fill in all the Fields'; // $_SESSION['emptyErr'] = $emptyErr; //// header('location: ../join.php'); //echo $emptyErr; // die(); // }else{ // } $hash = password_hash($password, PASSWORD_DEFAULT); } //echo 'test8'; //echo '<br>'; $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')"); $results = mysqli_query($mysqli, $query); while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){ //echo 'test4'; //echo '<br>'; $db_id = $row['id']; $db_name = $row['name']; $db_email = $row['email']; $db_password = $row['password']; } //echo $db_id; //echo '<br>'; //echo $db_name; //echo '<br>'; //echo $db_email; //echo '<br>'; //echo $db_password; //check if user exsists, if confirmed go to the login page so user can login. if ($db_name === $name && $db_email === $email){ $regErr = 'User Already Exsists!<br>Please Login'; $_SESSION['regErr'] = $regErr; //header('location: ../login.php'); echo $regErr; die(); }else //echo $name; //echo $db_id; if($db_name === $name && $db_email !== $email){ echo 'test4'; $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!'; //echo $name_existErr; } //echo $db_id; //echo '<br>'; //echo $db_name; //echo '<br>'; //echo $db_email; //echo '<br>'; //echo $db_password; if($db_email === $email && $db_name !== $name){ $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!'; //echo $email_existErr; } if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){ //if all valid and no errors, register new user to the database. $_SESSION['email'] = $email; $_SESSION['hash'] = $hash; $_SESSION['name'] = $name; echo 'no errors'; // header('location: register_user.inc.php'); }else{ //if validation shows errors go back to join form. // $_SESSION['emptyErr'] = $emptyErr; $_SESSION['email_existErr'] = $email_existErr; $_SESSION['name_existErr'] = $name_existErr; $_SESSION['emailErr'] = $emailErr; $_SESSION['passwordErr'] = $passwordErr; $_SESSION['confirm_passwordErr'] = $confirm_passwordErr; echo $email_existErr; echo '<br>'; echo $name_existErr; echo '<br>'; echo $confirm_passwordErr; echo '<br>'; echo $emailErr; echo '<br>'; echo $password_matchErr; echo '<br>'; echo $passwordErr; //header('Location: ../join.php'); } //echo $name; //echo $email; //echo $confirm_password; //echo $password; //echo $hash; ?>

Javascript 尝试验证所有字段是否有用户输入 sec_session_start(); error_reporting(E_ALL); ini_set('display_errors', 1); $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = ''; $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = ''; if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) { if($_POST['name2'] == "") { $emptyErr = 'Please fill in all the Fields'; $_SESSION['emptyErr'] = $emptyErr; header('location: ../join.php'); echo $emptyErr; echo 'emptyform'; die(); } }else{ $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING); // Sanitize the data passed in 'email' $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL); // validate the data passed in 'email' $email = filter_var($email, FILTER_VALIDATE_EMAIL); // check if email is valid if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { // Not a valid email $emailErr = "The email address you entered is not valid"; } //Sanitize the data passed in 'password' $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING); //validate the data passed in 'password' if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) { } else { $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the form!"; } //Sanitize the data passed in 'confirm_password' $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING); //check that password and confirm password match if ($password != $confirm_password) { // error matching passwords $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully."; } // if($name == '' && $email == '' && $password == '' && $confirm_password = '') { // $emptyErr - 'Please fill in all the Fields'; // $_SESSION['emptyErr'] = $emptyErr; //// header('location: ../join.php'); //echo $emptyErr; // die(); // }else{ // } $hash = password_hash($password, PASSWORD_DEFAULT); } //echo 'test8'; //echo '<br>'; $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')"); $results = mysqli_query($mysqli, $query); while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){ //echo 'test4'; //echo '<br>'; $db_id = $row['id']; $db_name = $row['name']; $db_email = $row['email']; $db_password = $row['password']; } //echo $db_id; //echo '<br>'; //echo $db_name; //echo '<br>'; //echo $db_email; //echo '<br>'; //echo $db_password; //check if user exsists, if confirmed go to the login page so user can login. if ($db_name === $name && $db_email === $email){ $regErr = 'User Already Exsists!<br>Please Login'; $_SESSION['regErr'] = $regErr; //header('location: ../login.php'); echo $regErr; die(); }else //echo $name; //echo $db_id; if($db_name === $name && $db_email !== $email){ echo 'test4'; $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!'; //echo $name_existErr; } //echo $db_id; //echo '<br>'; //echo $db_name; //echo '<br>'; //echo $db_email; //echo '<br>'; //echo $db_password; if($db_email === $email && $db_name !== $name){ $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!'; //echo $email_existErr; } if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){ //if all valid and no errors, register new user to the database. $_SESSION['email'] = $email; $_SESSION['hash'] = $hash; $_SESSION['name'] = $name; echo 'no errors'; // header('location: register_user.inc.php'); }else{ //if validation shows errors go back to join form. // $_SESSION['emptyErr'] = $emptyErr; $_SESSION['email_existErr'] = $email_existErr; $_SESSION['name_existErr'] = $name_existErr; $_SESSION['emailErr'] = $emailErr; $_SESSION['passwordErr'] = $passwordErr; $_SESSION['confirm_passwordErr'] = $confirm_passwordErr; echo $email_existErr; echo '<br>'; echo $name_existErr; echo '<br>'; echo $confirm_passwordErr; echo '<br>'; echo $emailErr; echo '<br>'; echo $password_matchErr; echo '<br>'; echo $passwordErr; //header('Location: ../join.php'); } //echo $name; //echo $email; //echo $confirm_password; //echo $password; //echo $hash; ?>,javascript,php,forms,validation,Javascript,Php,Forms,Validation,我想要一个验证表单服务器端,我已经验证了所有单独的字段,所有的工作,唯一的验证我无法得到的工作是验证表单提交时不是空的。在提交表单后的以下代码中,在if(isset($post语句)中接收表单。我要做的是检查字段是否为空,然后如果为空,则创建一条错误消息,然后使用标题('location:)转到会话变量中包含错误消息的已定义页面。如果验证返回已填充字段,则If语句的else部分将进行单独验证(这一切都按要求进行)。正如您在代码中看到的,我尝试了不同的选项来验证表单字段是否为空,我尝试过的这些选项

我想要一个验证表单服务器端,我已经验证了所有单独的字段,所有的工作,唯一的验证我无法得到的工作是验证表单提交时不是空的。在提交表单后的以下代码中,在if(isset($post语句)中接收表单。我要做的是检查字段是否为空,然后如果为空,则创建一条错误消息,然后使用标题('location:)转到会话变量中包含错误消息的已定义页面。如果验证返回已填充字段,则If语句的else部分将进行单独验证(这一切都按要求进行)。正如您在代码中看到的,我尝试了不同的选项来验证表单字段是否为空,我尝试过的这些选项都被注释掉了,在对密码进行散列之前,第一个if语句中有一个选项,在if语句中有另一个。我确实进行了客户端验证,但正如在堆栈溢出中经常提到的那样,这是一个很好的做法o执行服务器端验证。
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
因此,如果有人愿意帮助我解决这个问题,我将不胜感激

        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
php代码***************************

<?php
include_once 'db_connect.php';
include_once 'functions.php';

sec_session_start();



error_reporting(E_ALL); ini_set('display_errors', 1);

$emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
$email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
//       $emptyErr = 'Please fill in all the Fields';
//       $_SESSION['emptyErr'] = $emptyErr;
////         header('location: ../join.php');
//echo $emptyErr;
//echo 'emptyform';
//       die();
}else{

$name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
    // Sanitize the data passed in 'email'


$email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

    // validate the data passed in 'email'
    $email = filter_var($email, FILTER_VALIDATE_EMAIL);

    // check if email is valid
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

        // Not a valid email
        $emailErr = "The email address you entered is not valid";
    }

    //Sanitize the data passed in 'password'
$password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


    //validate the data passed in 'password'
    if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
        } else {
        $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
        }

    //Sanitize the data passed in 'confirm_password'
$confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

    //check that password and confirm password match
    if ($password != $confirm_password) {

         // error matching passwords
    $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
     }

//   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
//       $emptyErr - 'Please fill in all the Fields';
//       $_SESSION['emptyErr'] = $emptyErr;
////         header('location: ../join.php');
//echo $emptyErr;
//       die();
//   }else{
//   }

    $hash = password_hash($password, PASSWORD_DEFAULT);
}
//echo 'test8';
//echo '<br>';
$query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
$results = mysqli_query($mysqli, $query);

while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

//echo 'test4';
//echo '<br>'; 
$db_id = $row['id'];
$db_name = $row['name'];
$db_email = $row['email'];
$db_password = $row['password'];
}
//echo $db_id;
//echo '<br>';
//echo $db_name;
//echo '<br>';
//echo $db_email;
//echo '<br>';
//echo $db_password;             



//check if user exsists, if confirmed go to the login page so user can login.
    if ($db_name === $name && $db_email === $email){
$regErr = 'User Already Exsists!<br>Please Login';
$_SESSION['regErr'] = $regErr;
header('location: ../login.php');
//echo $regErr;
die();
    }else

//echo $name;
//echo $db_id;
    if($db_name === $name && $db_email !== $email){
//echo 'test4';     
    $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
//echo $name_existErr;  

            }
//echo $db_id;
//echo '<br>';
//echo $db_name;
//echo '<br>';
//echo $db_email;
//echo '<br>';
//echo $db_password;


            if($db_email === $email && $db_name !== $name){
    $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
//echo $email_existErr;
    }


            if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
//if all valid and no errors, register new user to the database.
        $_SESSION['email'] = $email;
        $_SESSION['hash'] = $hash;
        $_SESSION['name'] = $name;
echo 'no errors';
    header('location: register_user.inc.php');
    }else{
//if validation shows errors go back to join form.
//      $_SESSION['emptyErr'] = $emptyErr;
        $_SESSION['email_existErr'] = $email_existErr;
        $_SESSION['name_existErr'] = $name_existErr;
        $_SESSION['emailErr'] = $emailErr;
        $_SESSION['passwordErr'] = $passwordErr;
        $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
//echo $email_existErr;
//echo '<br>';
//echo $name_existErr;
//echo '<br>';
//echo $confirm_passwordErr;
//echo '<br>';
//echo $emailErr;
//echo '<br>';
//echo $password_matchErr;
//echo '<br>';
//echo $passwordErr;
header('Location: ../join.php');

    }

//echo $name;
//echo $email;
//echo $confirm_password;
//echo $password;
//echo $hash;
    ?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Dot Mov Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/styles/home.css" rel="stylesheet" type="text/css">
<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.-->
<script>var __adobewebfontsappname__="dreamweaver"</script>
<script src="http://use.edgefonts.net/lemon:n4:default.js" type="text/javascript"></script>
<script src="/js/civem.js"></script>
<script type='text/javascript' src='http://code.jquery.com/jquery.min.js'></script>
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>

<script src="/js/confirm_password__dbvalidate.js"></script>
<script src="/js/email_dbvalidate.js"></script>
<script src="/js/pswd_match.js"></script>
<script src="/js/pswrd_strength.js"></script>
<script src="/js/username_dbvalidate.js"></script>
<script type="text/javascript">

function SwapDivsWithClick(div1,div2)
{
   d1 = document.getElementById(div1);
   d2 = document.getElementById(div2);
   if( d2.style.display == "none" )
   {
      d1.style.display = "none";
      d2.style.display = "block";
   }
   else
   {
      d1.style.display = "block";
      d2.style.display = "none";
   }
}
</script>
</head>

<body>
<div id="video_container">
  <video muted autoplay loop >
    <source src="/video/South Dakota Badlands Scenic Byway 720p (Video Only)_1.3gp" type="video/3gp">
    <source src="/video/South Dakota Badlands Scenic Byway 720p (Video Only).webm" type="video/webm">
    <source src="/video/South Dakota Badlands Scenic Byway 720p.ogg" type="video/ogg">
    Your browser does not support the video tag. I suggest you upgrade your browser. </video>
</div>

<header>

  <div class="upload"><a href="upload.html" title="Upload" target="_self">UPLOAD</a></div>
        <div class="view"><a href="view.php" title="View" target="_self">VIEW</a></div>
            <div class="spacer1"></div>

                <div class="search_bar">
                  <form action="/search_results.php" method="post" name="search_database" autocomplete="on">
                    <input type="text" class="search" placeholder="Search">
                  </form>


    </div>
                <div class="logo_text">.MOV </div>
                <div class="tagline">Motorcycle Online Video</div>
</a></header>
<main>

  <div id="login" style="display:block">




            <form method="post" action="includes/login.inc.php" id="loginform">


                <input name="email" type="email" id="email" form="loginform" placeholder="Please Enter Your Email">


                <input name="password" type="password" id="password" form="loginform" placeholder="Please Enter Your Password" title="Please Enter Your Password">


<div class="submit_buttons">
          <input type="submit" class="login_btn" form="loginform" formaction="includes/login.inc.php" title="Login" value="Login">

<a href="javascript:SwapDivsWithClick('login','join')"><div class="join_but">Or Join</div></a>
        </div>
        <div id="forgotten_password">Forgotten Password</div>
        <div class="login_statements">
                      <div class="statement1">
                        <div class="by_joining">By Joining</div>
                        <div class="dot_mov">.MOV</div>
                        <div class="agree">You agree to our</div>
                      </div>
                      <div class="statement2">
                        <div class="terms_link"><a href="terms.html" title="Terms of Service" target="_self">Terms of Service</a></div>
                        <div class="and">and</div>
                        <div class="service_link"><a href="privacy.html" title="Privacy Policy" target="_self">Privacy Policy</a></div>
                      </div>

              </div>
                    <div class="facebook_login">
                        <div class="facebook_icon"><img src="images/fb.png" class="fb_icon"></div>
                        <div class="fb_link">Login with FaceBook </div>
              </div>
    </form>
  </div>                  


  </div>


  <div id="join" style="display: none;">




    <form action="includes/register.inc.php" method="post" id="joinform">

                <input name="name2" type="text" id="name2" form="joinform" placeholder="Please Enter Your Username" title="Please Enter Your Username">
                <div id="user-name">
         <h4>Username must meet the following requirements!<br>If the Usename doesnt meet the requirements you will be required to fill in the form again!</h4> 

                <div id="name_result"></div>
                <div id="name_length" class="invalid">At least <strong>6 letters</strong></div>


                </div>


                <input name="email2" type="text" id="email2" form="joinform" placeholder="Please Enter Your Email" title="Please Enter a Valid Email">
                <div id="user-email">
         <h4>Email must be a valid Email format!<br>If the Email doesnt meet the requirements you will be required to fill in the form again!</h4>
                <div id="email_result">
                <div id="email_validate" class="invalid">Email Valid</div>
                <div id="emaildb_validate"></div>
</div>

      </div>


      <input name="password2" type="password" id="password2" form="joinform" placeholder="Please Enter Your Password" title="Please Enter Your Password">
<div id="pswd_info">
    <h4>Password must meet the following requirements!<br>If the Password doesnt meet the requirements you will be required to fill in the form again!</h4>
    <ul id="pswd_list">
        <li id="letter" class="invalid">At least <strong>one letter</strong></li>
        <li id="capital" class="invalid">At least <strong>one capital letter</strong></li>
        <li id="number" class="invalid">At least <strong>one number</strong></li>
        <li id="length" class="invalid">Be at least <strong>8 characters</strong></li>
    </ul>
</div>

                <input name="confirm_password2" type="password" id="confirm_password2" form="joinform" placeholder="Please Confirm Your Password" title="Please Confirm Your Password">
            <div id="user-confirm_password">
       <h4>Please Confirm Password<br>If the Passwords do not match, you wil be required to fill in the form again!</h4>     

      <div id="error" class="error"></div>
            <div id="confirm_match" class="invalid">Passwords Match</div>




      </div>

      <div class="submit_buttons2">
                    <input name="join_btn2" type="submit" id="join_btn2" form="joinform" formaction="includes/register.inc.php" " formmethod="POST" title="Join" value="Join">

<a href="javascript:SwapDivsWithClick('login','join')"><div class="join_btn2">Or Login</div></a>
</div>


                                <div class="login_statements2">
                      <div class="statement1">
                        <div class="by_joining">By Joining</div>
                        <div class="dot_mov">.MOV</div>
                        <div class="agree">You agree to our</div>
                      </div>
                      <div class="statement2">
                        <div class="terms_link"><a href="terms.html" title="Terms of Service" target="_self">Terms of Service</a></div>
                        <div class="and">and</div>
                        <div class="service_link"><a href="privacy.html" title="Privacy Policy" target="_self">Privacy Policy</a></div>
                      </div>
                      </div>
                      <div class="facebook_login2">
                        <div class="facebook_icon"><img src="images/fb.png" class="fb_icon"></div>
                        <div class="fb_link">Login with FaceBook </div>
                        </div>
      </form>
  </div>                  




              </div>

  </div>
  <div class="scroll_container">
    <a data-scroll href="#body2"><div class="scroll_link">
      <div class="arrow"><img src="/images/arrow.png" alt="" class="arrow_icon"/></div>

      <div class="arrow3"><img src="/images/arrow.png" alt="" class="arrow_icon"/></div>
    Scroll Down</div></a>
  </div>







</main>

<div class="body2" id="body2">

  <div class="vid_grid">

    <div class="top_section">
        <div class="top_left_quarter"></div>
        <div class="top_right_quarter">
          <div class="top_right_left_quarter"></div>
          <div class="top_right_right_quarter"></div>
          <div class="top_right_bottom_left"></div>
          <div class="top_right_bottom_right"></div>
        </div>
    </div>

    <div class="bottom_section">
      <div class="bottpm_left_top"></div>
      <div class="bottpm_left_bottom"></div>
      <div class="bottom_middle"></div>     
        <div class="bottom_left_quarter"></div>
        <div class="bottom_right_quarter"></div>
        <div class="bottom_right_top"></div>
        <div class="bottom_right_bottom"></div>
    </div>
    <a href="/staff_picks.php"><div class="staff_picks">Staff Picks </div></a>


  </div>

</div>
<footer class="footer">
  <div id="breadcrumbs"><a href="/terms.html" title="Terms" target="_self">Terms</a> &vert; <a href="/privacy.html" title="Privacy" target="_self">Privacy</a> &vert; <a href="/about.html" title="About Us" target="_self">About Us</a> &vert; <a href="/copyright.html" title="Copyright" target="_self">Copyright</a> &vert; <a href="/cookies.html" title="Cookies" target="_self">Cookies</a> &vert; &reg &copy 2015</div><img src="/images/.mov.png" alt="" width="42" height="14" class="logo"/>
  <div class="social_media"><img src="/images/fb.png" alt="" width="30" height="30" class="fbicon"/><img src="/images/twitter.png" alt="" width="32" height="32" class="twittericon"/><img src="/images/googleplus.png" alt="" width="32" height="32" class="googleplusicon"/></div>



</footer>
<script src="/js/smooth-scroll.js"></script>
<script src="/js/smooth-scroll.min.js"></script>
<script type="text/javascript">
        smoothScroll.init({
            speed: 1000,
            easing: 'easeInOutCubic',
            offset: 0,
            updateURL: true,
            callbackBefore: function ( toggle, anchor ) {},
            callbackAfter: function ( toggle, anchor ) {}
        });
    </script>
</body>

</html>

php代码结束******************************

<?php
include_once 'db_connect.php';
include_once 'functions.php';

sec_session_start();



error_reporting(E_ALL); ini_set('display_errors', 1);

$emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
$email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
//       $emptyErr = 'Please fill in all the Fields';
//       $_SESSION['emptyErr'] = $emptyErr;
////         header('location: ../join.php');
//echo $emptyErr;
//echo 'emptyform';
//       die();
}else{

$name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
    // Sanitize the data passed in 'email'


$email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

    // validate the data passed in 'email'
    $email = filter_var($email, FILTER_VALIDATE_EMAIL);

    // check if email is valid
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

        // Not a valid email
        $emailErr = "The email address you entered is not valid";
    }

    //Sanitize the data passed in 'password'
$password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


    //validate the data passed in 'password'
    if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
        } else {
        $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
        }

    //Sanitize the data passed in 'confirm_password'
$confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

    //check that password and confirm password match
    if ($password != $confirm_password) {

         // error matching passwords
    $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
     }

//   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
//       $emptyErr - 'Please fill in all the Fields';
//       $_SESSION['emptyErr'] = $emptyErr;
////         header('location: ../join.php');
//echo $emptyErr;
//       die();
//   }else{
//   }

    $hash = password_hash($password, PASSWORD_DEFAULT);
}
//echo 'test8';
//echo '<br>';
$query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
$results = mysqli_query($mysqli, $query);

while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

//echo 'test4';
//echo '<br>'; 
$db_id = $row['id'];
$db_name = $row['name'];
$db_email = $row['email'];
$db_password = $row['password'];
}
//echo $db_id;
//echo '<br>';
//echo $db_name;
//echo '<br>';
//echo $db_email;
//echo '<br>';
//echo $db_password;             



//check if user exsists, if confirmed go to the login page so user can login.
    if ($db_name === $name && $db_email === $email){
$regErr = 'User Already Exsists!<br>Please Login';
$_SESSION['regErr'] = $regErr;
header('location: ../login.php');
//echo $regErr;
die();
    }else

//echo $name;
//echo $db_id;
    if($db_name === $name && $db_email !== $email){
//echo 'test4';     
    $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
//echo $name_existErr;  

            }
//echo $db_id;
//echo '<br>';
//echo $db_name;
//echo '<br>';
//echo $db_email;
//echo '<br>';
//echo $db_password;


            if($db_email === $email && $db_name !== $name){
    $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
//echo $email_existErr;
    }


            if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
//if all valid and no errors, register new user to the database.
        $_SESSION['email'] = $email;
        $_SESSION['hash'] = $hash;
        $_SESSION['name'] = $name;
echo 'no errors';
    header('location: register_user.inc.php');
    }else{
//if validation shows errors go back to join form.
//      $_SESSION['emptyErr'] = $emptyErr;
        $_SESSION['email_existErr'] = $email_existErr;
        $_SESSION['name_existErr'] = $name_existErr;
        $_SESSION['emailErr'] = $emailErr;
        $_SESSION['passwordErr'] = $passwordErr;
        $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
//echo $email_existErr;
//echo '<br>';
//echo $name_existErr;
//echo '<br>';
//echo $confirm_passwordErr;
//echo '<br>';
//echo $emailErr;
//echo '<br>';
//echo $password_matchErr;
//echo '<br>';
//echo $passwordErr;
header('Location: ../join.php');

    }

//echo $name;
//echo $email;
//echo $confirm_password;
//echo $password;
//echo $hash;
    ?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Dot Mov Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/styles/home.css" rel="stylesheet" type="text/css">
<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.-->
<script>var __adobewebfontsappname__="dreamweaver"</script>
<script src="http://use.edgefonts.net/lemon:n4:default.js" type="text/javascript"></script>
<script src="/js/civem.js"></script>
<script type='text/javascript' src='http://code.jquery.com/jquery.min.js'></script>
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>

<script src="/js/confirm_password__dbvalidate.js"></script>
<script src="/js/email_dbvalidate.js"></script>
<script src="/js/pswd_match.js"></script>
<script src="/js/pswrd_strength.js"></script>
<script src="/js/username_dbvalidate.js"></script>
<script type="text/javascript">

function SwapDivsWithClick(div1,div2)
{
   d1 = document.getElementById(div1);
   d2 = document.getElementById(div2);
   if( d2.style.display == "none" )
   {
      d1.style.display = "none";
      d2.style.display = "block";
   }
   else
   {
      d1.style.display = "block";
      d2.style.display = "none";
   }
}
</script>
</head>

<body>
<div id="video_container">
  <video muted autoplay loop >
    <source src="/video/South Dakota Badlands Scenic Byway 720p (Video Only)_1.3gp" type="video/3gp">
    <source src="/video/South Dakota Badlands Scenic Byway 720p (Video Only).webm" type="video/webm">
    <source src="/video/South Dakota Badlands Scenic Byway 720p.ogg" type="video/ogg">
    Your browser does not support the video tag. I suggest you upgrade your browser. </video>
</div>

<header>

  <div class="upload"><a href="upload.html" title="Upload" target="_self">UPLOAD</a></div>
        <div class="view"><a href="view.php" title="View" target="_self">VIEW</a></div>
            <div class="spacer1"></div>

                <div class="search_bar">
                  <form action="/search_results.php" method="post" name="search_database" autocomplete="on">
                    <input type="text" class="search" placeholder="Search">
                  </form>


    </div>
                <div class="logo_text">.MOV </div>
                <div class="tagline">Motorcycle Online Video</div>
</a></header>
<main>

  <div id="login" style="display:block">




            <form method="post" action="includes/login.inc.php" id="loginform">


                <input name="email" type="email" id="email" form="loginform" placeholder="Please Enter Your Email">


                <input name="password" type="password" id="password" form="loginform" placeholder="Please Enter Your Password" title="Please Enter Your Password">


<div class="submit_buttons">
          <input type="submit" class="login_btn" form="loginform" formaction="includes/login.inc.php" title="Login" value="Login">

<a href="javascript:SwapDivsWithClick('login','join')"><div class="join_but">Or Join</div></a>
        </div>
        <div id="forgotten_password">Forgotten Password</div>
        <div class="login_statements">
                      <div class="statement1">
                        <div class="by_joining">By Joining</div>
                        <div class="dot_mov">.MOV</div>
                        <div class="agree">You agree to our</div>
                      </div>
                      <div class="statement2">
                        <div class="terms_link"><a href="terms.html" title="Terms of Service" target="_self">Terms of Service</a></div>
                        <div class="and">and</div>
                        <div class="service_link"><a href="privacy.html" title="Privacy Policy" target="_self">Privacy Policy</a></div>
                      </div>

              </div>
                    <div class="facebook_login">
                        <div class="facebook_icon"><img src="images/fb.png" class="fb_icon"></div>
                        <div class="fb_link">Login with FaceBook </div>
              </div>
    </form>
  </div>                  


  </div>


  <div id="join" style="display: none;">




    <form action="includes/register.inc.php" method="post" id="joinform">

                <input name="name2" type="text" id="name2" form="joinform" placeholder="Please Enter Your Username" title="Please Enter Your Username">
                <div id="user-name">
         <h4>Username must meet the following requirements!<br>If the Usename doesnt meet the requirements you will be required to fill in the form again!</h4> 

                <div id="name_result"></div>
                <div id="name_length" class="invalid">At least <strong>6 letters</strong></div>


                </div>


                <input name="email2" type="text" id="email2" form="joinform" placeholder="Please Enter Your Email" title="Please Enter a Valid Email">
                <div id="user-email">
         <h4>Email must be a valid Email format!<br>If the Email doesnt meet the requirements you will be required to fill in the form again!</h4>
                <div id="email_result">
                <div id="email_validate" class="invalid">Email Valid</div>
                <div id="emaildb_validate"></div>
</div>

      </div>


      <input name="password2" type="password" id="password2" form="joinform" placeholder="Please Enter Your Password" title="Please Enter Your Password">
<div id="pswd_info">
    <h4>Password must meet the following requirements!<br>If the Password doesnt meet the requirements you will be required to fill in the form again!</h4>
    <ul id="pswd_list">
        <li id="letter" class="invalid">At least <strong>one letter</strong></li>
        <li id="capital" class="invalid">At least <strong>one capital letter</strong></li>
        <li id="number" class="invalid">At least <strong>one number</strong></li>
        <li id="length" class="invalid">Be at least <strong>8 characters</strong></li>
    </ul>
</div>

                <input name="confirm_password2" type="password" id="confirm_password2" form="joinform" placeholder="Please Confirm Your Password" title="Please Confirm Your Password">
            <div id="user-confirm_password">
       <h4>Please Confirm Password<br>If the Passwords do not match, you wil be required to fill in the form again!</h4>     

      <div id="error" class="error"></div>
            <div id="confirm_match" class="invalid">Passwords Match</div>




      </div>

      <div class="submit_buttons2">
                    <input name="join_btn2" type="submit" id="join_btn2" form="joinform" formaction="includes/register.inc.php" " formmethod="POST" title="Join" value="Join">

<a href="javascript:SwapDivsWithClick('login','join')"><div class="join_btn2">Or Login</div></a>
</div>


                                <div class="login_statements2">
                      <div class="statement1">
                        <div class="by_joining">By Joining</div>
                        <div class="dot_mov">.MOV</div>
                        <div class="agree">You agree to our</div>
                      </div>
                      <div class="statement2">
                        <div class="terms_link"><a href="terms.html" title="Terms of Service" target="_self">Terms of Service</a></div>
                        <div class="and">and</div>
                        <div class="service_link"><a href="privacy.html" title="Privacy Policy" target="_self">Privacy Policy</a></div>
                      </div>
                      </div>
                      <div class="facebook_login2">
                        <div class="facebook_icon"><img src="images/fb.png" class="fb_icon"></div>
                        <div class="fb_link">Login with FaceBook </div>
                        </div>
      </form>
  </div>                  




              </div>

  </div>
  <div class="scroll_container">
    <a data-scroll href="#body2"><div class="scroll_link">
      <div class="arrow"><img src="/images/arrow.png" alt="" class="arrow_icon"/></div>

      <div class="arrow3"><img src="/images/arrow.png" alt="" class="arrow_icon"/></div>
    Scroll Down</div></a>
  </div>







</main>

<div class="body2" id="body2">

  <div class="vid_grid">

    <div class="top_section">
        <div class="top_left_quarter"></div>
        <div class="top_right_quarter">
          <div class="top_right_left_quarter"></div>
          <div class="top_right_right_quarter"></div>
          <div class="top_right_bottom_left"></div>
          <div class="top_right_bottom_right"></div>
        </div>
    </div>

    <div class="bottom_section">
      <div class="bottpm_left_top"></div>
      <div class="bottpm_left_bottom"></div>
      <div class="bottom_middle"></div>     
        <div class="bottom_left_quarter"></div>
        <div class="bottom_right_quarter"></div>
        <div class="bottom_right_top"></div>
        <div class="bottom_right_bottom"></div>
    </div>
    <a href="/staff_picks.php"><div class="staff_picks">Staff Picks </div></a>


  </div>

</div>
<footer class="footer">
  <div id="breadcrumbs"><a href="/terms.html" title="Terms" target="_self">Terms</a> &vert; <a href="/privacy.html" title="Privacy" target="_self">Privacy</a> &vert; <a href="/about.html" title="About Us" target="_self">About Us</a> &vert; <a href="/copyright.html" title="Copyright" target="_self">Copyright</a> &vert; <a href="/cookies.html" title="Cookies" target="_self">Cookies</a> &vert; &reg &copy 2015</div><img src="/images/.mov.png" alt="" width="42" height="14" class="logo"/>
  <div class="social_media"><img src="/images/fb.png" alt="" width="30" height="30" class="fbicon"/><img src="/images/twitter.png" alt="" width="32" height="32" class="twittericon"/><img src="/images/googleplus.png" alt="" width="32" height="32" class="googleplusicon"/></div>



</footer>
<script src="/js/smooth-scroll.js"></script>
<script src="/js/smooth-scroll.min.js"></script>
<script type="text/javascript">
        smoothScroll.init({
            speed: 1000,
            easing: 'easeInOutCubic',
            offset: 0,
            updateURL: true,
            callbackBefore: function ( toggle, anchor ) {},
            callbackAfter: function ( toggle, anchor ) {}
        });
    </script>
</body>

</html>
Html代码********************************

<?php
include_once 'db_connect.php';
include_once 'functions.php';

sec_session_start();



error_reporting(E_ALL); ini_set('display_errors', 1);

$emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
$email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
//       $emptyErr = 'Please fill in all the Fields';
//       $_SESSION['emptyErr'] = $emptyErr;
////         header('location: ../join.php');
//echo $emptyErr;
//echo 'emptyform';
//       die();
}else{

$name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
    // Sanitize the data passed in 'email'


$email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

    // validate the data passed in 'email'
    $email = filter_var($email, FILTER_VALIDATE_EMAIL);

    // check if email is valid
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

        // Not a valid email
        $emailErr = "The email address you entered is not valid";
    }

    //Sanitize the data passed in 'password'
$password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


    //validate the data passed in 'password'
    if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
        } else {
        $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
        }

    //Sanitize the data passed in 'confirm_password'
$confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

    //check that password and confirm password match
    if ($password != $confirm_password) {

         // error matching passwords
    $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
     }

//   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
//       $emptyErr - 'Please fill in all the Fields';
//       $_SESSION['emptyErr'] = $emptyErr;
////         header('location: ../join.php');
//echo $emptyErr;
//       die();
//   }else{
//   }

    $hash = password_hash($password, PASSWORD_DEFAULT);
}
//echo 'test8';
//echo '<br>';
$query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
$results = mysqli_query($mysqli, $query);

while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

//echo 'test4';
//echo '<br>'; 
$db_id = $row['id'];
$db_name = $row['name'];
$db_email = $row['email'];
$db_password = $row['password'];
}
//echo $db_id;
//echo '<br>';
//echo $db_name;
//echo '<br>';
//echo $db_email;
//echo '<br>';
//echo $db_password;             



//check if user exsists, if confirmed go to the login page so user can login.
    if ($db_name === $name && $db_email === $email){
$regErr = 'User Already Exsists!<br>Please Login';
$_SESSION['regErr'] = $regErr;
header('location: ../login.php');
//echo $regErr;
die();
    }else

//echo $name;
//echo $db_id;
    if($db_name === $name && $db_email !== $email){
//echo 'test4';     
    $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
//echo $name_existErr;  

            }
//echo $db_id;
//echo '<br>';
//echo $db_name;
//echo '<br>';
//echo $db_email;
//echo '<br>';
//echo $db_password;


            if($db_email === $email && $db_name !== $name){
    $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
//echo $email_existErr;
    }


            if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
//if all valid and no errors, register new user to the database.
        $_SESSION['email'] = $email;
        $_SESSION['hash'] = $hash;
        $_SESSION['name'] = $name;
echo 'no errors';
    header('location: register_user.inc.php');
    }else{
//if validation shows errors go back to join form.
//      $_SESSION['emptyErr'] = $emptyErr;
        $_SESSION['email_existErr'] = $email_existErr;
        $_SESSION['name_existErr'] = $name_existErr;
        $_SESSION['emailErr'] = $emailErr;
        $_SESSION['passwordErr'] = $passwordErr;
        $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
//echo $email_existErr;
//echo '<br>';
//echo $name_existErr;
//echo '<br>';
//echo $confirm_passwordErr;
//echo '<br>';
//echo $emailErr;
//echo '<br>';
//echo $password_matchErr;
//echo '<br>';
//echo $passwordErr;
header('Location: ../join.php');

    }

//echo $name;
//echo $email;
//echo $confirm_password;
//echo $password;
//echo $hash;
    ?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Dot Mov Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/styles/home.css" rel="stylesheet" type="text/css">
<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.-->
<script>var __adobewebfontsappname__="dreamweaver"</script>
<script src="http://use.edgefonts.net/lemon:n4:default.js" type="text/javascript"></script>
<script src="/js/civem.js"></script>
<script type='text/javascript' src='http://code.jquery.com/jquery.min.js'></script>
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>

<script src="/js/confirm_password__dbvalidate.js"></script>
<script src="/js/email_dbvalidate.js"></script>
<script src="/js/pswd_match.js"></script>
<script src="/js/pswrd_strength.js"></script>
<script src="/js/username_dbvalidate.js"></script>
<script type="text/javascript">

function SwapDivsWithClick(div1,div2)
{
   d1 = document.getElementById(div1);
   d2 = document.getElementById(div2);
   if( d2.style.display == "none" )
   {
      d1.style.display = "none";
      d2.style.display = "block";
   }
   else
   {
      d1.style.display = "block";
      d2.style.display = "none";
   }
}
</script>
</head>

<body>
<div id="video_container">
  <video muted autoplay loop >
    <source src="/video/South Dakota Badlands Scenic Byway 720p (Video Only)_1.3gp" type="video/3gp">
    <source src="/video/South Dakota Badlands Scenic Byway 720p (Video Only).webm" type="video/webm">
    <source src="/video/South Dakota Badlands Scenic Byway 720p.ogg" type="video/ogg">
    Your browser does not support the video tag. I suggest you upgrade your browser. </video>
</div>

<header>

  <div class="upload"><a href="upload.html" title="Upload" target="_self">UPLOAD</a></div>
        <div class="view"><a href="view.php" title="View" target="_self">VIEW</a></div>
            <div class="spacer1"></div>

                <div class="search_bar">
                  <form action="/search_results.php" method="post" name="search_database" autocomplete="on">
                    <input type="text" class="search" placeholder="Search">
                  </form>


    </div>
                <div class="logo_text">.MOV </div>
                <div class="tagline">Motorcycle Online Video</div>
</a></header>
<main>

  <div id="login" style="display:block">




            <form method="post" action="includes/login.inc.php" id="loginform">


                <input name="email" type="email" id="email" form="loginform" placeholder="Please Enter Your Email">


                <input name="password" type="password" id="password" form="loginform" placeholder="Please Enter Your Password" title="Please Enter Your Password">


<div class="submit_buttons">
          <input type="submit" class="login_btn" form="loginform" formaction="includes/login.inc.php" title="Login" value="Login">

<a href="javascript:SwapDivsWithClick('login','join')"><div class="join_but">Or Join</div></a>
        </div>
        <div id="forgotten_password">Forgotten Password</div>
        <div class="login_statements">
                      <div class="statement1">
                        <div class="by_joining">By Joining</div>
                        <div class="dot_mov">.MOV</div>
                        <div class="agree">You agree to our</div>
                      </div>
                      <div class="statement2">
                        <div class="terms_link"><a href="terms.html" title="Terms of Service" target="_self">Terms of Service</a></div>
                        <div class="and">and</div>
                        <div class="service_link"><a href="privacy.html" title="Privacy Policy" target="_self">Privacy Policy</a></div>
                      </div>

              </div>
                    <div class="facebook_login">
                        <div class="facebook_icon"><img src="images/fb.png" class="fb_icon"></div>
                        <div class="fb_link">Login with FaceBook </div>
              </div>
    </form>
  </div>                  


  </div>


  <div id="join" style="display: none;">




    <form action="includes/register.inc.php" method="post" id="joinform">

                <input name="name2" type="text" id="name2" form="joinform" placeholder="Please Enter Your Username" title="Please Enter Your Username">
                <div id="user-name">
         <h4>Username must meet the following requirements!<br>If the Usename doesnt meet the requirements you will be required to fill in the form again!</h4> 

                <div id="name_result"></div>
                <div id="name_length" class="invalid">At least <strong>6 letters</strong></div>


                </div>


                <input name="email2" type="text" id="email2" form="joinform" placeholder="Please Enter Your Email" title="Please Enter a Valid Email">
                <div id="user-email">
         <h4>Email must be a valid Email format!<br>If the Email doesnt meet the requirements you will be required to fill in the form again!</h4>
                <div id="email_result">
                <div id="email_validate" class="invalid">Email Valid</div>
                <div id="emaildb_validate"></div>
</div>

      </div>


      <input name="password2" type="password" id="password2" form="joinform" placeholder="Please Enter Your Password" title="Please Enter Your Password">
<div id="pswd_info">
    <h4>Password must meet the following requirements!<br>If the Password doesnt meet the requirements you will be required to fill in the form again!</h4>
    <ul id="pswd_list">
        <li id="letter" class="invalid">At least <strong>one letter</strong></li>
        <li id="capital" class="invalid">At least <strong>one capital letter</strong></li>
        <li id="number" class="invalid">At least <strong>one number</strong></li>
        <li id="length" class="invalid">Be at least <strong>8 characters</strong></li>
    </ul>
</div>

                <input name="confirm_password2" type="password" id="confirm_password2" form="joinform" placeholder="Please Confirm Your Password" title="Please Confirm Your Password">
            <div id="user-confirm_password">
       <h4>Please Confirm Password<br>If the Passwords do not match, you wil be required to fill in the form again!</h4>     

      <div id="error" class="error"></div>
            <div id="confirm_match" class="invalid">Passwords Match</div>




      </div>

      <div class="submit_buttons2">
                    <input name="join_btn2" type="submit" id="join_btn2" form="joinform" formaction="includes/register.inc.php" " formmethod="POST" title="Join" value="Join">

<a href="javascript:SwapDivsWithClick('login','join')"><div class="join_btn2">Or Login</div></a>
</div>


                                <div class="login_statements2">
                      <div class="statement1">
                        <div class="by_joining">By Joining</div>
                        <div class="dot_mov">.MOV</div>
                        <div class="agree">You agree to our</div>
                      </div>
                      <div class="statement2">
                        <div class="terms_link"><a href="terms.html" title="Terms of Service" target="_self">Terms of Service</a></div>
                        <div class="and">and</div>
                        <div class="service_link"><a href="privacy.html" title="Privacy Policy" target="_self">Privacy Policy</a></div>
                      </div>
                      </div>
                      <div class="facebook_login2">
                        <div class="facebook_icon"><img src="images/fb.png" class="fb_icon"></div>
                        <div class="fb_link">Login with FaceBook </div>
                        </div>
      </form>
  </div>                  




              </div>

  </div>
  <div class="scroll_container">
    <a data-scroll href="#body2"><div class="scroll_link">
      <div class="arrow"><img src="/images/arrow.png" alt="" class="arrow_icon"/></div>

      <div class="arrow3"><img src="/images/arrow.png" alt="" class="arrow_icon"/></div>
    Scroll Down</div></a>
  </div>







</main>

<div class="body2" id="body2">

  <div class="vid_grid">

    <div class="top_section">
        <div class="top_left_quarter"></div>
        <div class="top_right_quarter">
          <div class="top_right_left_quarter"></div>
          <div class="top_right_right_quarter"></div>
          <div class="top_right_bottom_left"></div>
          <div class="top_right_bottom_right"></div>
        </div>
    </div>

    <div class="bottom_section">
      <div class="bottpm_left_top"></div>
      <div class="bottpm_left_bottom"></div>
      <div class="bottom_middle"></div>     
        <div class="bottom_left_quarter"></div>
        <div class="bottom_right_quarter"></div>
        <div class="bottom_right_top"></div>
        <div class="bottom_right_bottom"></div>
    </div>
    <a href="/staff_picks.php"><div class="staff_picks">Staff Picks </div></a>


  </div>

</div>
<footer class="footer">
  <div id="breadcrumbs"><a href="/terms.html" title="Terms" target="_self">Terms</a> &vert; <a href="/privacy.html" title="Privacy" target="_self">Privacy</a> &vert; <a href="/about.html" title="About Us" target="_self">About Us</a> &vert; <a href="/copyright.html" title="Copyright" target="_self">Copyright</a> &vert; <a href="/cookies.html" title="Cookies" target="_self">Cookies</a> &vert; &reg &copy 2015</div><img src="/images/.mov.png" alt="" width="42" height="14" class="logo"/>
  <div class="social_media"><img src="/images/fb.png" alt="" width="30" height="30" class="fbicon"/><img src="/images/twitter.png" alt="" width="32" height="32" class="twittericon"/><img src="/images/googleplus.png" alt="" width="32" height="32" class="googleplusicon"/></div>



</footer>
<script src="/js/smooth-scroll.js"></script>
<script src="/js/smooth-scroll.min.js"></script>
<script type="text/javascript">
        smoothScroll.init({
            speed: 1000,
            easing: 'easeInOutCubic',
            offset: 0,
            updateURL: true,
            callbackBefore: function ( toggle, anchor ) {},
            callbackAfter: function ( toggle, anchor ) {}
        });
    </script>
</body>

</html>

多特莫夫之家酒店
var\uuuu adobebfontsappname=“dreamweaver”
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
函数SwapDivsWithClick(第1部分,第2部分)
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
{ d1=document.getElementById(div1); d2=document.getElementById(div2); 如果(d2.style.display==“无”)
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
{ d1.style.display=“无”;
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
d2.style.display=“块”;
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
} 其他的
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
{ d1.style.display=“块”;
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
d2.style.display=“无”;
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
} } 您的浏览器不支持视频标记。我建议您升级浏览器。
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
莫夫先生 摩托车在线视频 忘记密码
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
加入 莫夫先生 你同意我们的建议吗 和 使用FaceBook登录 用户名必须符合以下要求!
如果Usename不符合要求,您将需要再次填写表单!
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
至少6个字母
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
电子邮件必须是有效的电子邮件格式!
如果电子邮件不符合要求,您需要重新填写表格!
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
电子邮件有效 密码必须符合以下要求!
如果密码不符合要求,您需要重新填写表格!
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
            sec_session_start();
    
    
    
            error_reporting(E_ALL); ini_set('display_errors', 1);
    
            $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
            $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';
    
    
            if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
                if($_POST['name2'] == "")
                {
                   $emptyErr = 'Please fill in all the Fields';
                   $_SESSION['emptyErr'] = $emptyErr;
                     header('location: ../join.php');
            echo $emptyErr;
            echo 'emptyform';
                   die();
            }
            }else{
    
            $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
                // Sanitize the data passed in 'email'
    
    
            $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);
    
                // validate the data passed in 'email'
                $email = filter_var($email, FILTER_VALIDATE_EMAIL);
    
                // check if email is valid
                if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    
                    // Not a valid email
                    $emailErr = "The email address you entered is not valid";
                }
    
                //Sanitize the data passed in 'password'
            $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);
    
    
                //validate the data passed in 'password'
                if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                    } else {
                    $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                    }
    
                //Sanitize the data passed in 'confirm_password'
            $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      
    
                //check that password and confirm password match
                if ($password != $confirm_password) {
    
                     // error matching passwords
                $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
                 }
    
            //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
            //       $emptyErr - 'Please fill in all the Fields';
            //       $_SESSION['emptyErr'] = $emptyErr;
            ////         header('location: ../join.php');
            //echo $emptyErr;
            //       die();
            //   }else{
            //   }
    
                $hash = password_hash($password, PASSWORD_DEFAULT);
            }
            //echo 'test8';
            //echo '<br>';
            $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
            $results = mysqli_query($mysqli, $query);
    
            while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){
    
            //echo 'test4';
            //echo '<br>'; 
            $db_id = $row['id'];
            $db_name = $row['name'];
            $db_email = $row['email'];
            $db_password = $row['password'];
            }
            //echo $db_id;
            //echo '<br>';
            //echo $db_name;
            //echo '<br>';
            //echo $db_email;
            //echo '<br>';
            //echo $db_password;             
    
    
    
            //check if user exsists, if confirmed go to the login page so user can login.
                if ($db_name === $name && $db_email === $email){
            $regErr = 'User Already Exsists!<br>Please Login';
            $_SESSION['regErr'] = $regErr;
            //header('location: ../login.php');
            echo $regErr;
            die();
                }else
    
            //echo $name;
            //echo $db_id;
                if($db_name === $name && $db_email !== $email){
            echo 'test4';       
                $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
            //echo $name_existErr;  
    
                        }
            //echo $db_id;
            //echo '<br>';
            //echo $db_name;
            //echo '<br>';
            //echo $db_email;
            //echo '<br>';
            //echo $db_password;
    
    
                        if($db_email === $email && $db_name !== $name){
                $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
            //echo $email_existErr;
                }
    
    
                        if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
            //if all valid and no errors, register new user to the database.
                    $_SESSION['email'] = $email;
                    $_SESSION['hash'] = $hash;
                    $_SESSION['name'] = $name;
            echo 'no errors';
            //  header('location: register_user.inc.php');
                }else{
            //if validation shows errors go back to join form.
            //      $_SESSION['emptyErr'] = $emptyErr;
                    $_SESSION['email_existErr'] = $email_existErr;
                    $_SESSION['name_existErr'] = $name_existErr;
                    $_SESSION['emailErr'] = $emailErr;
                    $_SESSION['passwordErr'] = $passwordErr;
                    $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
            echo $email_existErr;
            echo '<br>';
            echo $name_existErr;
            echo '<br>';
            echo $confirm_passwordErr;
            echo '<br>';
            echo $emailErr;
            echo '<br>';
            echo $password_matchErr;
            echo '<br>';
            echo $passwordErr;
            //header('Location: ../join.php');
    
                }
    
            //echo $name;
            //echo $email;
            //echo $confirm_password;
            //echo $password;
            //echo $hash;
                ?>
    
  • 至少一个字母
  •         sec_session_start();
    
    
    
            error_reporting(E_ALL); ini_set('display_errors', 1);
    
            $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
            $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';
    
    
            if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
                if($_POST['name2'] == "")
                {
                   $emptyErr = 'Please fill in all the Fields';
                   $_SESSION['emptyErr'] = $emptyErr;
                     header('location: ../join.php');
            echo $emptyErr;
            echo 'emptyform';
                   die();
            }
            }else{
    
            $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
                // Sanitize the data passed in 'email'
    
    
            $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);
    
                // validate the data passed in 'email'
                $email = filter_var($email, FILTER_VALIDATE_EMAIL);
    
                // check if email is valid
                if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    
                    // Not a valid email
                    $emailErr = "The email address you entered is not valid";
                }
    
                //Sanitize the data passed in 'password'
            $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);
    
    
                //validate the data passed in 'password'
                if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                    } else {
                    $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                    }
    
                //Sanitize the data passed in 'confirm_password'
            $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      
    
                //check that password and confirm password match
                if ($password != $confirm_password) {
    
                     // error matching passwords
                $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
                 }
    
            //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
            //       $emptyErr - 'Please fill in all the Fields';
            //       $_SESSION['emptyErr'] = $emptyErr;
            ////         header('location: ../join.php');
            //echo $emptyErr;
            //       die();
            //   }else{
            //   }
    
                $hash = password_hash($password, PASSWORD_DEFAULT);
            }
            //echo 'test8';
            //echo '<br>';
            $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
            $results = mysqli_query($mysqli, $query);
    
            while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){
    
            //echo 'test4';
            //echo '<br>'; 
            $db_id = $row['id'];
            $db_name = $row['name'];
            $db_email = $row['email'];
            $db_password = $row['password'];
            }
            //echo $db_id;
            //echo '<br>';
            //echo $db_name;
            //echo '<br>';
            //echo $db_email;
            //echo '<br>';
            //echo $db_password;             
    
    
    
            //check if user exsists, if confirmed go to the login page so user can login.
                if ($db_name === $name && $db_email === $email){
            $regErr = 'User Already Exsists!<br>Please Login';
            $_SESSION['regErr'] = $regErr;
            //header('location: ../login.php');
            echo $regErr;
            die();
                }else
    
            //echo $name;
            //echo $db_id;
                if($db_name === $name && $db_email !== $email){
            echo 'test4';       
                $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
            //echo $name_existErr;  
    
                        }
            //echo $db_id;
            //echo '<br>';
            //echo $db_name;
            //echo '<br>';
            //echo $db_email;
            //echo '<br>';
            //echo $db_password;
    
    
                        if($db_email === $email && $db_name !== $name){
                $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
            //echo $email_existErr;
                }
    
    
                        if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
            //if all valid and no errors, register new user to the database.
                    $_SESSION['email'] = $email;
                    $_SESSION['hash'] = $hash;
                    $_SESSION['name'] = $name;
            echo 'no errors';
            //  header('location: register_user.inc.php');
                }else{
            //if validation shows errors go back to join form.
            //      $_SESSION['emptyErr'] = $emptyErr;
                    $_SESSION['email_existErr'] = $email_existErr;
                    $_SESSION['name_existErr'] = $name_existErr;
                    $_SESSION['emailErr'] = $emailErr;
                    $_SESSION['passwordErr'] = $passwordErr;
                    $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
            echo $email_existErr;
            echo '<br>';
            echo $name_existErr;
            echo '<br>';
            echo $confirm_passwordErr;
            echo '<br>';
            echo $emailErr;
            echo '<br>';
            echo $password_matchErr;
            echo '<br>';
            echo $passwordErr;
            //header('Location: ../join.php');
    
                }
    
            //echo $name;
            //echo $email;
            //echo $confirm_password;
            //echo $password;
            //echo $hash;
                ?>
    
  • 至少一个大写字母
  •         sec_session_start();
    
    
    
            error_reporting(E_ALL); ini_set('display_errors', 1);
    
            $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
            $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';
    
    
            if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
                if($_POST['name2'] == "")
                {
                   $emptyErr = 'Please fill in all the Fields';
                   $_SESSION['emptyErr'] = $emptyErr;
                     header('location: ../join.php');
            echo $emptyErr;
            echo 'emptyform';
                   die();
            }
            }else{
    
            $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
                // Sanitize the data passed in 'email'
    
    
            $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);
    
                // validate the data passed in 'email'
                $email = filter_var($email, FILTER_VALIDATE_EMAIL);
    
                // check if email is valid
                if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    
                    // Not a valid email
                    $emailErr = "The email address you entered is not valid";
                }
    
                //Sanitize the data passed in 'password'
            $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);
    
    
                //validate the data passed in 'password'
                if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                    } else {
                    $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                    }
    
                //Sanitize the data passed in 'confirm_password'
            $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      
    
                //check that password and confirm password match
                if ($password != $confirm_password) {
    
                     // error matching passwords
                $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
                 }
    
            //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
            //       $emptyErr - 'Please fill in all the Fields';
            //       $_SESSION['emptyErr'] = $emptyErr;
            ////         header('location: ../join.php');
            //echo $emptyErr;
            //       die();
            //   }else{
            //   }
    
                $hash = password_hash($password, PASSWORD_DEFAULT);
            }
            //echo 'test8';
            //echo '<br>';
            $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
            $results = mysqli_query($mysqli, $query);
    
            while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){
    
            //echo 'test4';
            //echo '<br>'; 
            $db_id = $row['id'];
            $db_name = $row['name'];
            $db_email = $row['email'];
            $db_password = $row['password'];
            }
            //echo $db_id;
            //echo '<br>';
            //echo $db_name;
            //echo '<br>';
            //echo $db_email;
            //echo '<br>';
            //echo $db_password;             
    
    
    
            //check if user exsists, if confirmed go to the login page so user can login.
                if ($db_name === $name && $db_email === $email){
            $regErr = 'User Already Exsists!<br>Please Login';
            $_SESSION['regErr'] = $regErr;
            //header('location: ../login.php');
            echo $regErr;
            die();
                }else
    
            //echo $name;
            //echo $db_id;
                if($db_name === $name && $db_email !== $email){
            echo 'test4';       
                $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
            //echo $name_existErr;  
    
                        }
            //echo $db_id;
            //echo '<br>';
            //echo $db_name;
            //echo '<br>';
            //echo $db_email;
            //echo '<br>';
            //echo $db_password;
    
    
                        if($db_email === $email && $db_name !== $name){
                $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
            //echo $email_existErr;
                }
    
    
                        if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
            //if all valid and no errors, register new user to the database.
                    $_SESSION['email'] = $email;
                    $_SESSION['hash'] = $hash;
                    $_SESSION['name'] = $name;
            echo 'no errors';
            //  header('location: register_user.inc.php');
                }else{
            //if validation shows errors go back to join form.
            //      $_SESSION['emptyErr'] = $emptyErr;
                    $_SESSION['email_existErr'] = $email_existErr;
                    $_SESSION['name_existErr'] = $name_existErr;
                    $_SESSION['emailErr'] = $emailErr;
                    $_SESSION['passwordErr'] = $passwordErr;
                    $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
            echo $email_existErr;
            echo '<br>';
            echo $name_existErr;
            echo '<br>';
            echo $confirm_passwordErr;
            echo '<br>';
            echo $emailErr;
            echo '<br>';
            echo $password_matchErr;
            echo '<br>';
            echo $passwordErr;
            //header('Location: ../join.php');
    
                }
    
            //echo $name;
            //echo $email;
            //echo $confirm_password;
            //echo $password;
            //echo $hash;
                ?>
    
  • 至少一个数字
  •         sec_session_start();
    
    
    
            error_reporting(E_ALL); ini_set('display_errors', 1);
    
            $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
            $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';
    
    
            if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
                if($_POST['name2'] == "")
                {
                   $emptyErr = 'Please fill in all the Fields';
                   $_SESSION['emptyErr'] = $emptyErr;
                     header('location: ../join.php');
            echo $emptyErr;
            echo 'emptyform';
                   die();
            }
            }else{
    
            $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
                // Sanitize the data passed in 'email'
    
    
            $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);
    
                // validate the data passed in 'email'
                $email = filter_var($email, FILTER_VALIDATE_EMAIL);
    
                // check if email is valid
                if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    
                    // Not a valid email
                    $emailErr = "The email address you entered is not valid";
                }
    
                //Sanitize the data passed in 'password'
            $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);
    
    
                //validate the data passed in 'password'
                if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                    } else {
                    $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                    }
    
                //Sanitize the data passed in 'confirm_password'
            $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      
    
                //check that password and confirm password match
                if ($password != $confirm_password) {
    
                     // error matching passwords
                $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
                 }
    
            //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
            //       $emptyErr - 'Please fill in all the Fields';
            //       $_SESSION['emptyErr'] = $emptyErr;
            ////         header('location: ../join.php');
            //echo $emptyErr;
            //       die();
            //   }else{
            //   }
    
                $hash = password_hash($password, PASSWORD_DEFAULT);
            }
            //echo 'test8';
            //echo '<br>';
            $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
            $results = mysqli_query($mysqli, $query);
    
            while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){
    
            //echo 'test4';
            //echo '<br>'; 
            $db_id = $row['id'];
            $db_name = $row['name'];
            $db_email = $row['email'];
            $db_password = $row['password'];
            }
            //echo $db_id;
            //echo '<br>';
            //echo $db_name;
            //echo '<br>';
            //echo $db_email;
            //echo '<br>';
            //echo $db_password;             
    
    
    
            //check if user exsists, if confirmed go to the login page so user can login.
                if ($db_name === $name && $db_email === $email){
            $regErr = 'User Already Exsists!<br>Please Login';
            $_SESSION['regErr'] = $regErr;
            //header('location: ../login.php');
            echo $regErr;
            die();
                }else
    
            //echo $name;
            //echo $db_id;
                if($db_name === $name && $db_email !== $email){
            echo 'test4';       
                $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
            //echo $name_existErr;  
    
                        }
            //echo $db_id;
            //echo '<br>';
            //echo $db_name;
            //echo '<br>';
            //echo $db_email;
            //echo '<br>';
            //echo $db_password;
    
    
                        if($db_email === $email && $db_name !== $name){
                $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
            //echo $email_existErr;
                }
    
    
                        if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
            //if all valid and no errors, register new user to the database.
                    $_SESSION['email'] = $email;
                    $_SESSION['hash'] = $hash;
                    $_SESSION['name'] = $name;
            echo 'no errors';
            //  header('location: register_user.inc.php');
                }else{
            //if validation shows errors go back to join form.
            //      $_SESSION['emptyErr'] = $emptyErr;
                    $_SESSION['email_existErr'] = $email_existErr;
                    $_SESSION['name_existErr'] = $name_existErr;
                    $_SESSION['emailErr'] = $emailErr;
                    $_SESSION['passwordErr'] = $passwordErr;
                    $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
            echo $email_existErr;
            echo '<br>';
            echo $name_existErr;
            echo '<br>';
            echo $confirm_passwordErr;
            echo '<br>';
            echo $emailErr;
            echo '<br>';
            echo $password_matchErr;
            echo '<br>';
            echo $passwordErr;
            //header('Location: ../join.php');
    
                }
    
            //echo $name;
            //echo $email;
            //echo $confirm_password;
            //echo $password;
            //echo $hash;
                ?>
    
  • 至少应8个字符
  •         sec_session_start();
    
    
    
            error_reporting(E_ALL); ini_set('display_errors', 1);
    
            $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
            $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';
    
    
            if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
                if($_POST['name2'] == "")
                {
                   $emptyErr = 'Please fill in all the Fields';
                   $_SESSION['emptyErr'] = $emptyErr;
                     header('location: ../join.php');
            echo $emptyErr;
            echo 'emptyform';
                   die();
            }
            }else{
    
            $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
                // Sanitize the data passed in 'email'
    
    
            $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);
    
                // validate the data passed in 'email'
                $email = filter_var($email, FILTER_VALIDATE_EMAIL);
    
                // check if email is valid
                if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    
                    // Not a valid email
                    $emailErr = "The email address you entered is not valid";
                }
    
                //Sanitize the data passed in 'password'
            $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);
    
    
                //validate the data passed in 'password'
                if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                    } else {
                    $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                    }
    
                //Sanitize the data passed in 'confirm_password'
            $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      
    
                //check that password and confirm password match
                if ($password != $confirm_password) {
    
                     // error matching passwords
                $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
                 }
    
            //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
            //       $emptyErr - 'Please fill in all the Fields';
            //       $_SESSION['emptyErr'] = $emptyErr;
            ////         header('location: ../join.php');
            //echo $emptyErr;
            //       die();
            //   }else{
            //   }
    
                $hash = password_hash($password, PASSWORD_DEFAULT);
            }
            //echo 'test8';
            //echo '<br>';
            $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
            $results = mysqli_query($mysqli, $query);
    
            while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){
    
            //echo 'test4';
            //echo '<br>'; 
            $db_id = $row['id'];
            $db_name = $row['name'];
            $db_email = $row['email'];
            $db_password = $row['password'];
            }
            //echo $db_id;
            //echo '<br>';
            //echo $db_name;
            //echo '<br>';
            //echo $db_email;
            //echo '<br>';
            //echo $db_password;             
    
    
    
            //check if user exsists, if confirmed go to the login page so user can login.
                if ($db_name === $name && $db_email === $email){
            $regErr = 'User Already Exsists!<br>Please Login';
            $_SESSION['regErr'] = $regErr;
            //header('location: ../login.php');
            echo $regErr;
            die();
                }else
    
            //echo $name;
            //echo $db_id;
                if($db_name === $name && $db_email !== $email){
            echo 'test4';       
                $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
            //echo $name_existErr;  
    
                        }
            //echo $db_id;
            //echo '<br>';
            //echo $db_name;
            //echo '<br>';
            //echo $db_email;
            //echo '<br>';
            //echo $db_password;
    
    
                        if($db_email === $email && $db_name !== $name){
                $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
            //echo $email_existErr;
                }
    
    
                        if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
            //if all valid and no errors, register new user to the database.
                    $_SESSION['email'] = $email;
                    $_SESSION['hash'] = $hash;
                    $_SESSION['name'] = $name;
            echo 'no errors';
            //  header('location: register_user.inc.php');
                }else{
            //if validation shows errors go back to join form.
            //      $_SESSION['emptyErr'] = $emptyErr;
                    $_SESSION['email_existErr'] = $email_existErr;
                    $_SESSION['name_existErr'] = $name_existErr;
                    $_SESSION['emailErr'] = $emailErr;
                    $_SESSION['passwordErr'] = $passwordErr;
                    $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
            echo $email_existErr;
            echo '<br>';
            echo $name_existErr;
            echo '<br>';
            echo $confirm_passwordErr;
            echo '<br>';
            echo $emailErr;
            echo '<br>';
            echo $password_matchErr;
            echo '<br>';
            echo $passwordErr;
            //header('Location: ../join.php');
    
                }
    
            //echo $name;
            //echo $email;
            //echo $confirm_password;
            //echo $password;
            //echo $hash;
                ?>
    
请确认密码
如果密码不匹配,您需要重新填写表格!
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
密码匹配
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>

如果每个字段为空,可以通过简单的if条件进行验证,如

if($_POST['fieldname'] == "")
return $error
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
这是第一个字段的编辑代码,您可以对其他字段执行相同的操作
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
sec_session_start();
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
错误报告(全部);ini集合(“显示错误”,1);
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
$emailErr=$passwordErr=$password\u matchErr=$email\u exister=$nameErr=$name\u exister=$confirm\u passwordErr=$emptyErr='';
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
$email=$name=$password=$confirm\u password=$results=$row=$db\u email=$db\u id=$db\u name=$db\u password='';
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
如果(isset($\u POST['name2'],$\u POST['email2'],$\u POST['paswword2'],$\u POST['confirm\u password2'])){
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
如果($_POST['name2']==“”) { $emptyErr='请填写所有字段';
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
$\会话['emptyErr']=$emptyErr; 标题('location:../join.php'); echo$emptyErr; 回声“空形式”; 模具(); } }否则{
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
$name=filter\u input(input\u POST,'name2',filter\u SANITIZE\u STRING); //清理“电子邮件”中传递的数据
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
$email=filter\u input(input\u POST,'email2',filter\u SANITIZE\u email); //验证“电子邮件”中传递的数据
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
$email=filter\u var($email,filter\u VALIDATE\u email); //检查电子邮件是否有效
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
如果(!filter_var($email,filter_VALIDATE_email)){ //不是有效的电子邮件 $emailErr=“您输入的电子邮件地址无效”;
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
} //清理传入“密码”的数据
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
$password=filter\u input(input\u POST,'password2',filter\u SANITIZE\u STRING);
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
//验证传入“密码”的数据
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
if(preg_match(“/^.*(=.{8,})(?=.*\d)(?=.[a-z])(?=.[a-z]).*$/”,$password)){
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
}否则{
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
$passwordErr=“密码无效!
请确保您的密码格式与填写表单时所述的格式相同!”;
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
} //清理“确认\u密码”中传递的数据
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
$confirm\u password=filter\u input(输入\u POST,'confirm\u password2',filter\u SANITIZE\u字符串);
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
//检查密码并确认密码匹配
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>
如果($密码=
        sec_session_start();



        error_reporting(E_ALL); ini_set('display_errors', 1);

        $emailErr = $passwordErr = $password_matchErr = $email_existErr = $nameErr = $name_existErr = $confirm_passwordErr = $emptyErr = '';
        $email = $name = $password = $confirm_password = $results = $row = $db_email = $db_id = $db_name = $db_password = '';


        if (isset($_POST['name2'], $_POST['email2'], $_POST['paswword2'],$_POST['confirm_password2'])) {
            if($_POST['name2'] == "")
            {
               $emptyErr = 'Please fill in all the Fields';
               $_SESSION['emptyErr'] = $emptyErr;
                 header('location: ../join.php');
        echo $emptyErr;
        echo 'emptyform';
               die();
        }
        }else{

        $name = filter_input(INPUT_POST, 'name2', FILTER_SANITIZE_STRING);
            // Sanitize the data passed in 'email'


        $email = filter_input(INPUT_POST, 'email2', FILTER_SANITIZE_EMAIL);

            // validate the data passed in 'email'
            $email = filter_var($email, FILTER_VALIDATE_EMAIL);

            // check if email is valid
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

                // Not a valid email
                $emailErr = "The email address you entered is not valid";
            }

            //Sanitize the data passed in 'password'
        $password = filter_input(INPUT_POST, 'password2', FILTER_SANITIZE_STRING);


            //validate the data passed in 'password'
            if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password)) {
                } else {
                $passwordErr = "Password is invalid!<br>Please ensure your password is formatted as described when filling in the       form!";
                }

            //Sanitize the data passed in 'confirm_password'
        $confirm_password = filter_input(INPUT_POST, 'confirm_password2', FILTER_SANITIZE_STRING);      

            //check that password and confirm password match
            if ($password != $confirm_password) {

                 // error matching passwords
            $confirm_passwordErr = "Your passwords do not match.<br>Please type carefully.";
             }

        //   if($name == '' && $email == '' && $password == '' && $confirm_password = '') {
        //       $emptyErr - 'Please fill in all the Fields';
        //       $_SESSION['emptyErr'] = $emptyErr;
        ////         header('location: ../join.php');
        //echo $emptyErr;
        //       die();
        //   }else{
        //   }

            $hash = password_hash($password, PASSWORD_DEFAULT);
        }
        //echo 'test8';
        //echo '<br>';
        $query = ("SELECT * FROM signed_up WHERE (email = '$email') OR (name = '$name')");
        $results = mysqli_query($mysqli, $query);

        while ($row = mysqli_fetch_array($results, MYSQLI_BOTH)){

        //echo 'test4';
        //echo '<br>'; 
        $db_id = $row['id'];
        $db_name = $row['name'];
        $db_email = $row['email'];
        $db_password = $row['password'];
        }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;             



        //check if user exsists, if confirmed go to the login page so user can login.
            if ($db_name === $name && $db_email === $email){
        $regErr = 'User Already Exsists!<br>Please Login';
        $_SESSION['regErr'] = $regErr;
        //header('location: ../login.php');
        echo $regErr;
        die();
            }else

        //echo $name;
        //echo $db_id;
            if($db_name === $name && $db_email !== $email){
        echo 'test4';       
            $name_existErr = 'Username has to be Unique!<br>If this is your Username Please Login!<br>If this is not your Username Please Join with a different Username!';
        //echo $name_existErr;  

                    }
        //echo $db_id;
        //echo '<br>';
        //echo $db_name;
        //echo '<br>';
        //echo $db_email;
        //echo '<br>';
        //echo $db_password;


                    if($db_email === $email && $db_name !== $name){
            $email_existErr = 'Email has to be Unique<br>If this is your Email Please goto Login!<br>If this is not your Email check your Email and fill the Form in Again!';
        //echo $email_existErr;
            }


                    if($emailErr =='' && $passwordErr =='' && $confirm_passwordErr == '' && $email_existErr == '' && $name_existErr == '' && $emptyErr = ''){
        //if all valid and no errors, register new user to the database.
                $_SESSION['email'] = $email;
                $_SESSION['hash'] = $hash;
                $_SESSION['name'] = $name;
        echo 'no errors';
        //  header('location: register_user.inc.php');
            }else{
        //if validation shows errors go back to join form.
        //      $_SESSION['emptyErr'] = $emptyErr;
                $_SESSION['email_existErr'] = $email_existErr;
                $_SESSION['name_existErr'] = $name_existErr;
                $_SESSION['emailErr'] = $emailErr;
                $_SESSION['passwordErr'] = $passwordErr;
                $_SESSION['confirm_passwordErr'] = $confirm_passwordErr;
        echo $email_existErr;
        echo '<br>';
        echo $name_existErr;
        echo '<br>';
        echo $confirm_passwordErr;
        echo '<br>';
        echo $emailErr;
        echo '<br>';
        echo $password_matchErr;
        echo '<br>';
        echo $passwordErr;
        //header('Location: ../join.php');

            }

        //echo $name;
        //echo $email;
        //echo $confirm_password;
        //echo $password;
        //echo $hash;
            ?>