mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 20:21:37 +00:00
Empty commit
This commit is contained in:
parent
a6d7b4ce40
commit
4a08c9ccfb
@ -283,5 +283,20 @@ public static function update_user_notes($UserID, $AdminComment) {
|
||||
WHERE UserID = \''.db_string($UserID).'\'');
|
||||
G::$DB->set_query_id($QueryID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an IP is part of a given CIDR range.
|
||||
* @param string $CheckIP the IP to be looked up
|
||||
* @param string $Subnet the CIDR subnet to be checked against
|
||||
*/
|
||||
public static function check_cidr_range($CheckIP, $Subnet) {
|
||||
$IP = ip2long($CheckIP);
|
||||
$CIDR = split('/',$Subnet);
|
||||
$SubnetIP = ip2long($CIDR[0]);
|
||||
$SubnetMaskBits = 32 - $CIDR[1];
|
||||
|
||||
return (($IP>>$SubnetMaskBits) == ($SubnetIP>>$SubnetMaskBits));
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user