created db login function