Login system, PDO and me
You should also make heavy use of the filter functions of PHP.

&lt;?php

if (filter_input(INPUT_POST, "form_id", FILTER_UNSAFE_RAW) === filter_input(INPUT_SESSION, "form_id", FILTER_UNSAFE_RAW)) {
  $username = filter_input(INPUT_POST, "username", FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
  $password = filter_input(INPUT_POST, "password", FILTER_UNSAFE_RAW);

  if ($username &amp;&amp; $password) {
    $database-&gt;query("SELECT `username`, `password`, `active` FROM `admin` WHERE `username` = :username AND `password` = :password LIMIT 1");
    $database-&gt;bind(":username", $username);
    $result = $database-&gt;resultset();

    if (isset($result[0]) &amp;&amp; password_verify($password, $result[0]["password"])) {
      echo "Welcome!";
    }
  }
}