Move auth validation login to auth_functions.php
TODO: Fix undefined variable notice on line 28