gethostbyaddr is for reverse lookup. But I believe Bill is asking for help on how to determine the real IP of a visitor. So, IP has to be known first, before apply gethostbyaddr.
Spoofing? Yes, IP can be spoofed, whether you use getenv($REMOTE_ADDR), or getenv(HTTP_X_FORWARDED_FOR).
I'm not sure what the fool-proof solution is.
Richard Akindele
geocities.com/akindele/