I use php sessions (not cookies, except for session id cookie) for all user data, and when a user goes to their profile user.mydomain.com they are immediately \"logged out\"
Before session_start() use session_set_cookie_params() replacing .domain.com with your domain like this example:
session_start()
session_set_cookie_params()
session_set_cookie_params(0, '/', '.domain.com'); session_start();