allowing for multiple comma separated CIDR ranges

This commit is contained in:
Christian Haschek
2022-02-19 10:47:07 +01:00
parent 8ee26e6922
commit cf0effd0e8

View File

@@ -601,6 +601,15 @@ function deleteHash($hash)
* via https://stackoverflow.com/a/56050595/1174516
*/
function isIPInRange( $ip, $range ) {
if(substr(',',$range)!==false)
{
// we got a list of ranges. splitting
$ranges = array_map('trim',explode(',',$range));
foreach($ranges as $range)
if(isIPInRange($ip,$range)) return true;
return false;
}
// Get mask bits
list($net, $maskBits) = explode('/', $range);