checkLogin function

Checks whether the user is logged in.