added database functionality to checklogin