title: hash password and verify it with same variable
body: <p>i tried to create this register page more secure then i add this code for password</p>
  
  <pre><code>$pas_usr = mysqli_real_escape_string($koneksi, $_POST['pas_usr']);
  $pas_usr = password_hash($pas_usr, PASSWORD_BCRYPT);
  </code></pre>
  
  <p>the result is in password column is encrypted</p>
  
  <p>then in login page, when i tried to verify it it says wrong password</p>
  
  <p>here's my login page :</p>
  
  <pre><code>//memulai session baru
  session_start();
  
  //memanggil koneksi
  include "koneksi.php";
  
  $username = $_POST['username'];
  $password = $_POST['password'];
  $username = stripslashes($username);  
  $password = stripslashes($password);  
  $username = mysqli_real_escape_string($koneksi, $username);  
  $password = mysqli_real_escape_string($koneksi, $password);  
  $hashquery = mysqli_fetch_assoc(mysqli_query($koneksi, "SELECT * FROM `user` WHERE log_usr = '$username'"));
  $hash=$hashquery['hash'];
  
  if(password_verify($password, $hash)){
  
  $query = mysqli_query($koneksi, "SELECT * from user WHERE log_usr='$username'");
  $exitCount=mysqli_num_rows($query);
      if($exitCount==1){
              $data = mysqli_fetch_array($query);
              $id = $data["log_usr"];
              $lvl = $data["sts_usr"];
  
              if ($lvl=='A')
              {
                  $link = 'index.html';
              }
              elseif($lvl='U')
              {
                  $link = 'index.php';
              }
          $_SESSION['username'] = $username;
          header ("location:$link");
          exit();
      }else{
          echo "&lt;script&gt;alert('Username dan Password tidak valid.'); window.location = 'index.php'&lt;/script&gt;";
      }
  }else{
      echo "&lt;script&gt;alert('Username dan Password tidak valid.'); window.location = 'index.php'&lt;/script&gt;";
  }
  </code></pre>