loggedin and other functions for admin