note 4408 deleted from function.gethostbyaddr by felipe
| From: | felipe@php.net | Date: | Sat, 29 Dec 2007 17:28:28 +0000 |
| Subject: | note 4408 deleted from function.gethostbyaddr by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134133@lists.php.net to get a copy of this message | ||
Note Submitter: php3 at bigsky dot net
----
To check a host's address:
<pre>
$r_hostname = gethostbyaddr($REMOTE_ADDR);
if ($REMOTE_ADDR == "$r_hostname") {
....
}
</pre>
This will fail if a lookup on the name returns the IP as the domain name (which can happen if you
control a DNS server), but it's a pretty contrived example, and in any other case it will work.