function valid_ip_cidr($cidr, $must_cidr = false) { if (!preg_match("/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(\/[0-9]{1,2})?$/", $cidr)) { $return = false; } else { $return = true; } if ($return == true) { $parts = explode("/", $cidr); $ip = $parts[0]; $netmask = $parts[1]; $octets = explode(".", $ip); foreach ($octets as $octet) { if ($octet > 255) { $return = false; } } if ((($netmask != "") && ($netmask > 32) && !$must_cidr) || (($netmask == ""||$netmask > 32) && $must_cidr)) { $return = false; } } return $return; }
Dear immortals, I need some wow gold inspiration to create.