note 109919 added to function.filter-var
| From: | marcus at synchromedia dot co dot uk | Date: | Mon, 03 Sep 2012 09:13:52 +0000 |
| Subject: | note 109919 added to function.filter-var | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190446@lists.php.net to get a copy of this message | ||
Further to joelhy's tip about checking private IPs, it's very likely that you actually
want to detect all reserved ranges, not just private IPs, and there's another constant for them
that should be bitwise-OR'd with it.
<?php
function is_private_ip($ip) {
return !filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE |
FILTER_FLAG_NO_RES_RANGE);
}
?>
----
Server IP: 195.221.21.36
Probable Submitter: 77.204.55.124
----
Manual Page -- http://www.php.net/manual/en/function.filter-var.php
Edit -- https://master.php.net/note/edit/109919
Del: integrated -- https://master.php.net/note/delete/109919/integrated
Del: useless -- https://master.php.net/note/delete/109919/useless
Del: bad code -- https://master.php.net/note/delete/109919/bad+code
Del: spam -- https://master.php.net/note/delete/109919/spam
Del: non-english -- https://master.php.net/note/delete/109919/non-english
Del: in docs -- https://master.php.net/note/delete/109919/in+docs
Del: other reasons-- https://master.php.net/note/delete/109919
Reject -- https://master.php.net/note/reject/109919
Search -- https://master.php.net/manage/user-notes.php