note 12866 deleted from function.gethostbyaddr by felipe
| From: | felipe@php.net | Date: | Sat, 29 Dec 2007 20:52:25 +0000 |
| Subject: | note 12866 deleted from function.gethostbyaddr by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134216@lists.php.net to get a copy of this message | ||
Note Submitter: god at weaponzero dot f2s dot com
Reason: 1
----
say you want to protect the IP of your visitors and only show the hostname?
$ip = getenv('REMOTE_HOST');
$host = @GetHostByAddr($ip);
$real_host=chop($host);
if($real_host){
$host_arr=explode(".", $real_host);
$count=count($host_arr);
if($count > 1){
if(intval($host_arr[$count-1])!=0){
$host=substr($real_host,0,strrpos($real_host,".")).".*";
}
else{
$host = "*".strstr($real_host, ".");
}
}
else{
$host=$real_host;
}
}
else{
$host="";
}
for me that would put *.dab.bellsouth.net and for AOLers it woud put *.proxy.aol.com