note 30543 added to function.gethostbyaddr

From: Date: Fri, 21 Mar 2003 14:39:54 +0000
Subject: note 30543 added to function.gethostbyaddr
Groups: php.notes 
Request: Send a blank email to php-notes+get-45606@lists.php.net to get a copy of this message
In response to god at weaponzero dot f2s dot com: I found this much easier to write. <?php $ip = $_SERVER['REMOTE_ADDR']; $fullhost = gethostbyaddr($ip); $host = preg_replace("/^[^.]+./", "*.", $fullhost); ?> IP address <?=$ip?> | Host: <?=$host?> You can still protect the IP of your visitors and only show the hostname or show them both. -- http://www.php.net/manual/en/function.gethostbyaddr.php http://master.php.net/manage/user-notes.php?action=edit+30543 http://master.php.net/manage/user-notes.php?action=delete+30543 http://master.php.net/manage/user-notes.php?action=reject+30543

« previous php.notes (#45606) next »