REMOTE_ADDR doesn't always contain the client machine's IP.
First check HTTP_X_FORWARDED_FOR. If there's something there, it should be the client IP. If not, go to REMOTE_ADDR.
Had problems using REMOTE_ADDR as was using it for IP verification as part of security measures -- had a user whose REMOTE_ADDR kept changing (every few seconds) and looking at HTTP_X_FORWARDED_FOR solved the problem.