EasySiteFireWall防火墙模块-PHP源码
EasySite FireWall 防火墙模块= 5){ header('HTTP/1.1 403 Forbidden'); $_SESSION['FireWall']['lasttime'] = $nowtime; exit('HTTP/1.1 403 ES FireWall Forbidden : Not allowed CC'); } }else{ $_SESSION['FireWall']['fwtimes'] = 0; $_SESSION['FireWall']['lasttime'] = $nowtime; } }else{ $_SESSION['FireWall']['fwtimes'] = 1; $_SESSION['FireWall']['lasttime'] = $nowtime; } unset($nowtime, $lasttime, $fwtimes); } ?>
2. [PHP]代码
$_SERVER['REQUEST_TIME'] || $rule['end_time'] < $_SERVER['REQUEST_TIME']) continue; $ip = str_replace('.', '\.', $rule['ip']); if($start = strstr($ip, '-')){ $start = substr($ip, 0, - strlen(strrchr($ip, '.')) + 1); $pos = explode('-', trim(strrchr($ip, '.'), '.')); for($i=intval($pos[0]),$a=intval($pos[1])+1; $i < $a; $i++ ){ $arr[] = '#^'.$start.$i.'$#i'; } }elseif($start = strstr($ip, '[')){ $_ips = explode('|', substr($start, 1, -1)); $arr[] = '#^'.substr($ip, 0, - strlen($start)).'(('.implode(')|(',$_ips ).'))'.'$#i'; }elseif(strpos($ip, '*')){ $arr[] = '#^'.str_replace('*', '((25[0-5])|(2[0-4]\\d)|(1\\d{2})|(\\d{1,2}))', $ip).'$#i'; }else{ $arr[] = '#^'.$ip.'$#i'; } } return $arr; } ?>
以上就是EasySite FireWall 防火墙模块的内容,更多相关内容请关注PHP中文网(www.php1.cn)!
PHP之友评论