put login program in a function