as subject
$_SERVER and [man]gethostbyname[/man].
$_SERVER['REMOTE_ADDR'] is a reasonable accurate way to see the clients IP address...
Check hotscripts.com to get a better idea of it, something that takes into account proxies.