如何防止dede網站DDos被攻擊;第一步:進入後台,系統-》添加新變量變量名稱:cfg_anquan_cc
變量類型:布爾(Y/N)
參數說明:是否開啟防CC攻擊:
變量值:Y 第二步:編輯,/member/config.php 在require_once(DEDEINC.'/dedetemplate.class.php');下添加代碼
if($cfg_anquan_cc == 'Y'){
//php防CC攻擊 在3秒內連續刷新頁面5次以上將指向本機 http:///404.html
$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",'http:///404.html'));
exit;
}
}else{
$ll_times = 0;
$_SESSION['ll_lasttime'] = $ll_nowtime;
$_SESSION['ll_times'] = $ll_times;
}
}