Hi, I'm trying to write my own little subroutine to log only the incoming user's ip address in a log file. I can't seem to figure out which variable request(REMOTE_HOST etc) will work. Thanks in advance. Dan
$ip=$REMOTE_ADDR;
check php.net for a list of those kinds of things
More properly (since php 4.1):
$ip=$_SERVER['REMOTE_ADDR'];
Note: Most of the time this will be the address of the last proxy the request travelled through, not the users actual address on their computer. Use with caution/grain of salt.
I remember my old logs had the actual domain which would provide the name of the provider like attbi.xxx.xxx or pacbellxxxx, does this sound familiar?
If you are trying to resolve ip address to friendly names you may want to look at the Network functions in php. Just remember the speed of your script will be at the mercy of the DNS system
http://www.php.net/manual/en/ref.network.php