您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

用于过滤快速重复的请求

2024/3/10 16:40:57发布18次查看
无详细内容 无 ?phpfunction c($key){ $c_arr = array( 'ddos_memcache_persistent_id_count' = 200, 'ddos_memcache_host' = '127.0.0.1', // 需要重启apache生效 'ddos_memcache_port' = 11211, // 需要重启apache生效 'ddos_memcache_expire' = 2, ); retu
200, 'ddos_memcache_host' => '127.0.0.1', // 需要重启apache生效 'ddos_memcache_port' => 11211, // 需要重启apache生效 'ddos_memcache_expire' => 2, ); return $c_arr[$key];}/** * @brief isddos 判断是否为过快速的ddos攻击 * * @param $index_arr * * @return */function isddos($index_arr){ $persistent_id = mt_rand(1, c('ddos_memcache_persistent_id_count')); $m = new memcached($persistent_id); if(!$m->getserverlist()) { $m->addserver(c('ddos_memcache_host'), c('ddos_memcache_port')); } $key = md5(http_build_query($index_arr)); $ret = $m->get($key) === 1 ? true : false; $m->set($key, 1, c('ddos_memcache_expire')); return $ret;}if(isddos(array('tjx', 'fdf'))){ echo 'ddos'; die();}sleep(2);echo 'return value';
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product