在config_global.php文件中有以下代碼php
- $_config['security']['attackevasive'] = 0;
複製代碼
能夠設置的值有:數組
- 0表示關閉此功能
- 1表示cookie刷新限制
- 2表示限制代理訪問
- 4表示二次請求
- 8表示回答問題(第一次訪問時須要回答問題)
複製代碼
同時也能夠設置爲組合的方式,如1|2表示同時啓用cookie刷新限制和限制代理訪問。
在source/class/class_core.php文件中能夠找到以下代碼cookie
- if($this->config['security']['attackevasive'] && (!defined('CURSCRIPT') || !in_array($this->var['mod'], array('seccode', 'secqaa', 'swfupload')))) {
- require_once libfile('misc/security', 'include');
- }
複製代碼
$this->config['security']['attackevasive']爲config_global.php文件裏設置的$_config['security']['attackevasive']的值。
找到source/misc/misc_security.php文件ide
- if(is_string($this->config['security']['attackevasive'])) {
- //若是$this->config['security']['attackevasive']是字符串
- $attackevasive_tmp = explode('|', $this->config['security']['attackevasive']);
- 根據分隔符|分割$this->config['security']['attackevasive']獲得數組$attackevasive_tmp
- $attackevasive = 0;
- foreach($attackevasive_tmp AS $key => $value) {
- $attackevasive += intval($value);
- //將數組$attackevasive中每項的值加起來獲得$attackevasive
- }
- unset($attackevasive_tmp);
- } else {
- $attackevasive = $this->config['security']['attackevasive'];
- }
複製代碼
- $lastrequest = isset($_G['cookie']['lastrequest']) ? authcode($_G['cookie']['lastrequest'], 'DECODE') : '';
複製代碼
獲取上一次請求的時間。
$_G['cookie']['lastrequest']爲記錄上一次請求時間的cookie。ui
- if($attackevasive & 1 || $attackevasive & 4) {
- dsetcookie('lastrequest', authcode(TIMESTAMP, 'ENCODE'), TIMESTAMP + 816400, 1, true);
- }
複製代碼
若是設置的是cookie刷新限制($attackevasive & 1)或者二次請求($attackevasive & 4)的方式,那麼建立以當前時間爲值的上一次請求的cookie。this
- if($attackevasive & 1) {
- if(TIMESTAMP - $lastrequest < 1) {
- securitymessage('attackevasive_1_subject', 'attackevasive_1_message');
- }
- }
複製代碼
cookie刷新限制的方式:當前時間-上一次請求的時間<1的時候會有頁面重載的提示。url
- if(($attackevasive & 2) && ($_SERVER['HTTP_X_FORWARDED_FOR'] ||
- $_SERVER['HTTP_VIA'] || $_SERVER['HTTP_PROXY_CONNECTION'] ||
- $_SERVER['HTTP_USER_AGENT_VIA'] || $_SERVER['HTTP_CACHE_INFO'] ||
- $_SERVER['HTTP_PROXY_CONNECTION'])) {
- securitymessage('attackevasive_2_subject', 'attackevasive_2_message', FALSE);
- }
複製代碼
限制代理訪問的方式。spa
- if($attackevasive & 4) {
- if(empty($lastrequest) || TIMESTAMP - $lastrequest > 300) {
- securitymessage('attackevasive_4_subject', 'attackevasive_4_message');
- }
- }
複製代碼
二次請求的方式:當前時間-上一次請求時間>300秒的時候會有頁面重載的提示。.net
- if($attackevasive & 8) {
- list($visitcode, $visitcheck, $visittime) = explode('|', authcode($_G['cookie']['visitcode'], 'DECODE'));
- if(!$visitcode || !$visitcheck || !$visittime || TIMESTAMP - $visittime > 60 * 60 * 4 ) {
- if(empty($_POST['secqsubmit']) || ($visitcode != md5($_POST['answer']))) {
- $answer = 0;
- $question = '';
- for ($i = 0; $i< rand(2, 5); $i ++) {
- $r = rand(1, 20);
- $question .= $question ? ' + '.$r : $r;
- $answer += $r;
- }
- $question .= ' = ?';
- dsetcookie('visitcode', authcode(md5($answer).'|0|'.TIMESTAMP, 'ENCODE'), TIMESTAMP + 816400, 1, true);
- securitymessage($question, '<input type="text" name="answer" size="8" maxlength="150" /><input type="submit" name="secqsubmit" class="button" value=" Submit " />', FALSE, TRUE);
- } else {
- dsetcookie('visitcode', authcode($visitcode.'|1|'.TIMESTAMP, 'ENCODE'), TIMESTAMP + 816400, 1, true);
- }
- }
-
- }
複製代碼
回答問題的方式:第一次訪問時須要回答問題。代理
本文由3D電影下載編輯!