Detect ip of client?

Yea I'm actually one step ahead of you on that. But how do you log the client out?