$word) { $temp[$key] = ucfirst(strtolower($word)); } return join ('', $temp); } // Determine if an IP address resides in a CIDR netblock or netblocks. function match_cidr($addr, $cidr) { $output = false; if (is_array($cidr)) { foreach ($cidr as $cidrlet) { if (match_cidr($addr, $cidrlet)) { $output = true; break; } } } else { @list($ip, $mask) = explode('/', $cidr); if (!$mask) $mask = 32; $mask = pow(2,32) - pow(2, (32 - $mask)); $output = ((ip2long($addr) & $mask) == (ip2long($ip) & $mask)); } return $output; } // Obtain all the HTTP headers. // NB: on PHP-CGI we have to fake it out a bit, since we can't get the REAL // headers. Run PHP as Apache 2.0 module if possible for best results. function bb2_load_headers() { if (!is_callable('getallheaders')) { $headers = array(); foreach ($_SERVER as $h => $v) if (preg_match('/HTTP_(.+)/', $h, $hp)) $headers[str_replace("_", "-", uc_all($hp[1]))] = $v; } else { $headers = getallheaders(); } return $headers; } ?>