title: Codeigniter password_verify method
body: <p>I have this   method in my Codeigniter (version 3.0) login module. It works fine but is this safe? Is any better solution to check login and password using PHP password_verify?
  (PHP 5.6,
  MySQL 5.0).</p>
  
  <pre><code>        $user = $this-&gt;input-&gt;post('username');
          $password = $this-&gt;input-&gt;post('password');
          $myquery = $this-&gt;db-&gt;query("SELECT * FROM users WHERE user = '$user'");
          $row = $myquery-&gt;row();
  
          if (isset($row))
          {
              //Using hashed password - PASSWORD_BCRYPT method - from database
              $hash = $row-&gt;password;
  
  
              if (password_verify($password, $hash)) {
  
                  echo 'Password is valid!';
  
  
              } else {
  
                  echo 'Invalid password.';
  
              }
  
  
          } else{
  
              echo 'Wrong user!';
          }
  </code></pre>