replace ['user']['id'] with get_user_id() everywhere
Handle session timeout