login and some base function