[ Index ]

PHP Cross Reference of phpwcms V1.4.7 _r403 (01.11.10)

title

Body

[close]

/include/inc_ext/bad-behavior/bad-behavior/ -> whitelist.inc.php (source)

   1  <?php if (!defined('BB2_CORE')) die('I said no cheating!');
   2  
   3  function bb2_whitelist($package)
   4  {
   5      $whitelists = @parse_ini_file(dirname(BB2_CORE) . "/whitelist.ini");
   6  
   7      if (@!empty($whitelists['ip'])) {
   8          foreach ($whitelists['ip'] as $range) {
   9              if (match_cidr($package['ip'], $range)) return true;
  10          }
  11      }
  12      if (@!empty($whitelists['useragent'])) {
  13          foreach ($whitelists['useragent'] as $user_agent) {
  14              if (!strcmp($package['headers_mixed']['User-Agent'], $user_agent)) return true;
  15          }
  16      }
  17      if (@!empty($whitelists['url'])) {
  18          if (strpos($package['request_uri'], "?") === FALSE) {
  19              $request_uri = $package['request_uri'];
  20          } else {
  21              $request_uri = substr($package['request_uri'], 0, strpos($package['request_uri'], "?"));
  22          }
  23          foreach ($whitelists['url'] as $url) {
  24              if (!strcmp($request_uri, $url)) return true;
  25          }
  26      }
  27      return false;
  28  }
  29  
  30  ?>


Generated: Tue Nov 16 22:51:00 2010 Cross-referenced by PHPXref 0.7