allowing multiple ip ranges in checking function

This commit is contained in:
Chris
2020-06-15 10:47:57 +02:00
parent 75784174fa
commit e13f4816fb

View File

@@ -595,6 +595,13 @@ function deleteHash($hash)
* via https://gist.github.com/tott/7684443
*/
function isIPInRange( $ip, $range ) {
if(strpos($range,',')!==false)
{
$ranges = explode(',',$range);
foreach($ranges as $range)
if(isIPInRange( $ip, $range )) return true;
return false;
}
if ( strpos( $range, '/' ) == false )
{
$range .= '/32';