Revize c1bdc1c4
Přidáno uživatelem Michal Kliment před více než 9 roky(ů)
application/models/allowed_subnet.php | ||
---|---|---|
return 0;
|
||
}
|
||
|
||
/**
|
||
* Returns allowed subnet by member and ip address
|
||
*
|
||
* @author Michal Kliment
|
||
* @param integer $member_id
|
||
* @param string $ip_address
|
||
* @return Mysql_Result object
|
||
*/
|
||
public function get_allowed_subnet_by_member_and_ip_address($member_id, $ip_address)
|
||
{
|
||
$result = $this->db->query("
|
||
SELECT a.* FROM subnets s
|
||
JOIN allowed_subnets a ON a.subnet_id = s.id
|
||
WHERE inet_aton(s.netmask) & inet_aton(?) = inet_aton(s.network_address)
|
||
AND a.member_id = ?
|
||
", array($ip_address, $member_id));
|
||
|
||
return ($result && $result->count()) ? $result->current() : NULL;
|
||
}
|
||
|
||
}
|
Také k dispozici: Unified diff
Release 1.1.0