diff options
author | friendica <info@friendica.com> | 2012-05-03 16:45:30 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-05-03 16:45:30 -0700 |
commit | ff75dc4e40fdd7237c5fe889f4d722c979107dd8 (patch) | |
tree | c5d23bc3cb7420bca74563827c365fe4b2f89759 /include | |
parent | 6a5e5096dbdaa4763f1838d2a7a406faf0fc3d28 (diff) | |
parent | 52915c6e68672650b2f510b0a230959f800083a2 (diff) | |
download | volse-hubzilla-ff75dc4e40fdd7237c5fe889f4d722c979107dd8.tar.gz volse-hubzilla-ff75dc4e40fdd7237c5fe889f4d722c979107dd8.tar.bz2 volse-hubzilla-ff75dc4e40fdd7237c5fe889f4d722c979107dd8.zip |
Merge pull request #284 from fabrixxm/master
validate_url() and validate_email() validate also IP address.
Diffstat (limited to 'include')
-rw-r--r-- | include/network.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/network.php b/include/network.php index 4bec4a172..27a45ec40 100644 --- a/include/network.php +++ b/include/network.php @@ -583,7 +583,7 @@ function fetch_xrd_links($url) { // Take a URL from the wild, prepend http:// if necessary -// and check DNS to see if it's real +// and check DNS to see if it's real (or check if is a valid IP address) // return true if it's OK, false if something is wrong with it if(! function_exists('validate_url')) { @@ -596,7 +596,7 @@ function validate_url(&$url) { $url = 'http://' . $url; $h = @parse_url($url); - if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR))) { + if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR) || filter_var($h['host'], FILTER_VALIDATE_IP) )) { return true; } return false; @@ -611,7 +611,7 @@ function validate_email($addr) { return false; $h = substr($addr,strpos($addr,'@') + 1); - if(($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX))) { + if(($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX) || filter_var($h['host'], FILTER_VALIDATE_IP) )) { return true; } return false; |