refactor login.php