我不理解Chrome开发者工具控制台警告

时间:2019-12-17 15:25:13

标签: php html google-chrome

我正在学习PHP和MySQL。我正在使用登录/注册系统。

我在Chrome开发者工具控制台上收到此错误,但我不知道是什么原因导致了此错误:

[Deprecation] Resource requests whose URLs contained both removed whitespace (`\n`, `\r`, `\t`) characters and less-than characters (`<`) are blocked. Please remove newlines and encode less-than characters from places like element attribute values in order to load these resources. See https://www.chromestatus.com/feature/5735596811091968 for more details.

出现此错误的页面是我的登录表单页面login.php,其代码如下:

<?php
  include 'bp_db.php';
  bp_header();
?>
    <div class="row">
      <div class="col-lg-12">
        <h1 class="display-4 text-center pb-4">Login</h1>
        <div class="container">
          <div class="row justify-content-center">
            <div class="col-lg-5">
              <form class="text-center" action="login.php" method="post">
                <div class="form-group">
                  <label for="username">Username</label>
                  <input type="text" class="form-control" id="username" value="<?php if(isset($_COOKIE['username'])){echo $_COOKIE['username'];} ?>" aria-describedby="userName" name="username" required>
                </div>
                <div class="form-group">
                  <label for="password">Password</label>
                  <input type="password" class="form-control" value="<?php if(isset($_COOKIE['password'])){echo $_COOKIE['password'];} ?>"id="password" name="password" required >
                </div>
                <div class="form-group form-check">
                  <input type="checkbox" class="form-check-input" id="rememberMe" name="rememberMe">
                  <label class="form-check-label" for="rememberMe">Remember me!</label>
                </div>
                <button type="submit" class="btn btn-block btn-info">Submit</button>
                <hr class="border-top border-dark">
                <p class="text-muted text-center">Don't have an account? <a href="register.php">Sign up!</a></p>
              </form>
          <?php
            if(isset($_POST['username']) && isset($_POST['password'])){
              $login_username = $_POST['username'];
              $login_password = $_POST['password'];
              $sql = "SELECT * FROM users WHERE username = :username";
              $stmt = $pdo->prepare($sql);
              $stmt->execute(['username' => $login_username]);
              $getUser = $stmt->fetch();
              $password_verify = password_verify($login_password, $getUser->password);
              if($password_verify == true){
                $sql = "SELECT * FROM users WHERE username = :username && password = :password";
                $stmt = $pdo->prepare($sql);
                $stmt->execute(['username' => $login_username, 'password' => $getUser->password]);
                $user = $stmt->fetch();
                if($user){
                  if(isset($_POST['rememberMe'])){
                    setcookie("username", $login_username, time()+86400);
                    setcookie("password", $login_password, time()+86400);
                  }
                  $_SESSION['username'] = $user->username;
                  header('location: ' . HOME);
                }else{
                  echo 'There is no account whit this credential! Register a new account!';
                }
              }else{
                echo "Wrong password!";
              }
            }
          ?>
            </div>
          </div>
        </div>
      </div>
    </div>
<?php bp_footer(); ?>

我不明白是什么导致了此错误。我该怎么解决?

0 个答案:

没有答案