第一步:进入后台,系统-》添加新变量变量名称:cfg_anquan_cc
变量类型:布尔(Y/N) (推荐学习:dedecms教程)
参数说明:是否开启防CC攻击:
变量值:Y
第二步:编辑,/member/config.PHP 在require_once(DEDEINC.'/dedetemplate.class.PHP');下添加代码
if($cfg_anquan_cc == 'Y'){
//PHP防CC攻击 在3秒内连续刷新页面5次以上将指向本机 //www.jb51.net/404.htm
$P_S_T = $t_array[0] + $t_array[1];
$timest amp = time();
session_start();
$ll_nowtime = $timestamp ;
if (session_is_registered('ll_lasttime')){
$ll_lasttime = $_SESSION['ll_lasttime'];
$ll_times = $_SESSION['ll_times'] + 1;
$_SESSION['ll_times'] = $ll_times;
}else{
$ll_lasttime = $ll_nowtime;
$ll_times = 1;
$_SESSION['ll_times'] = $ll_times;
$_SESSION['ll_lasttime'] = $ll_lasttime;
}
if (($ll_nowtime - $ll_lasttime)<3){
if ($ll_times>=5){
header(sprintf("Location: %s",'//www.jb51.net/404.htm'));
exit;
}
}else{
$ll_times = 0;
$_SESSION['ll_lasttime'] = $ll_nowtime;
$_SESSION['ll_times'] = $ll_times;
}
}