Add log_message() function to record messages
Add check_login() function to ensure a user is logged