implement check login to database at the server side