mirror of
https://github.com/HaschekSolutions/pictshare.git
synced 2025-11-14 12:08:01 +00:00
allowing for multiple comma separated CIDR ranges
This commit is contained in:
@@ -601,6 +601,15 @@ function deleteHash($hash)
|
|||||||
* via https://stackoverflow.com/a/56050595/1174516
|
* via https://stackoverflow.com/a/56050595/1174516
|
||||||
*/
|
*/
|
||||||
function isIPInRange( $ip, $range ) {
|
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
|
// Get mask bits
|
||||||
list($net, $maskBits) = explode('/', $range);
|
list($net, $maskBits) = explode('/', $range);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user