Added database login function