login function based on post data.