implementation of login, gettrend function