Um, stefanwagner's reply was perfectly valid and contained information helpful to you if you bothered to look. At the very least, it contained the information that your question was not well stated in the first place.
I can only imagine you're talking about running an ISP of sorts where people dial up and log on, or you're using a server and some thin-clients. The only way I reached that conclusion was by reading your mind. Not everyone is psychic, though, and you shouldn't take that attitude when someone tries to help you and infers the wrong thing from your question. Everyone loves that attitude, too, especially me.
Also, upon recieving a reply, if you find it unsatisfactory, you'd be much better off restating your question than giving an equally unhelpful response such as yours.
If I'm right about what you're trying to do, you're trying do it the wrong way, anyway. Look at the configuration for whatever server you're using to grant your remote access. That's where you'll find the correct way to deny someone access or log usage based on IP.
The .profile would run for people who log on locally as well as remotely. Your IP-detection thing would be pointless for them. Most people are used to local log ins, by the way, which explains the response of, "A user has no IP."
It would also be easy to bypass something in my .profile designed to keep me from logging in. I could just comment it out.
And please don't give me any attitude in the case that I didn't guess exactly what you meant.