Here's an example for the subnet permissions:
global_start
PHP Code:
function cidr_match($ip, $range)
{
list($subnet, $bits) = explode('/', $range);
$ip = ip2long($ip);
$subnet = ip2long($subnet);
$mask = -1 << (32 - $bits);
$subnet &= $mask;
return $subnet == ($ip & $mask);
}
// deny users who match this
if (!cidr_match($_SERVER['REMOTE_ADDR'], '192.168.12.0/23'))
{
print_no_permission();
}
I can give a full example with forum permissions later this week. Not enough time at the moment.