refactor function validate user, add config.php