add methods to sql

* has_user: checks if user exists
* is_logged_in: check if user is logged in
* valid_key: check if the user's provided key matches the database's key