Moved over to PDO and finished login

Updated queries to use prepared statements and PDO in preperation for
SQLite support.