Skip to content
Snippets Groups Projects
Commit 5d0e31b7 authored by Thom's avatar Thom :tools:
Browse files

Apply suggestion from !1358

parent 571ca4e3
No related branches found
No related tags found
No related merge requests found
...@@ -305,10 +305,12 @@ class validate_dns { ...@@ -305,10 +305,12 @@ class validate_dns {
// Check if it's a valid input // Check if it's a valid input
foreach($field_value_array as $field_value) { foreach($field_value_array as $field_value) {
// Check if the IP is valid without range // Check if the IP is valid without range
$ip = strstr($field_value, '/', true) ?: $field_value; $subnet = '';
if (strpos($field_value, '/') !== false) { $ip = $field_value;
$subnet = strstr($field_value, '/', false); if(strpos($ip, '/') !== false) {
$subnet = ltrim($subnet, "/"); list($ip, $subnet) = explode('/', $ip, 2);
$ip = trim($ip);
$subnet = intval($subnet);
} }
if(function_exists('filter_var')) { if(function_exists('filter_var')) {
if(!filter_var($ip, FILTER_VALIDATE_IP)) { if(!filter_var($ip, FILTER_VALIDATE_IP)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment