login and register sliced and established database connection