故障描述:
2 c7 r$ O0 N# m8 p3 C& g k& c
退出登录时出现”您当前的访问请求当中含有非法字符,已经被系统拒绝“错误。
/ K$ a; j ?( w) A; s
解决方法:
x. `7 Z4 w1 x X) W
打开 sourceclassdiscuzdiscuz_application.php 文件
! \; n" Y7 E5 Z) m U
找到
& C+ o" E# i, G* C. Cprivate function _xss_check() {
6 ~# R/ K" e9 i) [% `- Q, T
1 G& t$ Z- F8 U- h. s0 {; D
static $check = array('"', '>', '<', ''', '(', ')', 'CONTENT-TRANSFER-ENCODING');
' u) a2 Y6 c' ~+ H2 J" S# A, c
if(isset($_GET['formhash']) && $_GET['formhash'] !== formhash()) {
% R) [" v* h0 W4 M- I
system_error('request_tainting');
p1 q6 X6 p1 }9 c$ ]0 {# r
}
. J' @. \1 ~& w9 F$ m$ e- ~
8 U+ o& B! ?. q6 d6 Q2 U1 i( n i if($_SERVER['REQUEST_METHOD'] == 'GET' ) {
) ~; L& d- Q0 v2 {2 B8 j+ ~
$temp = $_SERVER['REQUEST_URI'];
+ r J5 ^" m8 v, J; m& g0 F
} elseif(empty ($_GET['formhash'])) {
d% H) A( f1 t* l j$ } $temp = $_SERVER['REQUEST_URI'].file_get_contents('php://input');
8 ]) g. Z5 m% D. B& g5 d } else {
! S: S" _# @, w3 g2 R
$temp = '';
$ V- L9 W; L3 ?) e6 O; G) s' \ }
3 }2 p: ?9 p/ J3 d
' r7 Q. w' d1 l. S# G* G if(!empty($temp)) {
$ p8 \- f/ Z7 w
$temp = strtoupper(urldecode(urldecode($temp)));
7 N" S( t# c. I& _9 p
foreach ($check as $str) {
/ U. c3 \6 L8 Y2 U6 u/ d5 R if(strpos($temp, $str) !== false) {
3 Q. E! a! W& w9 O# g% N6 j1 G
system_error('request_tainting');
1 _3 w+ q- y* b) g }
* n% E1 [3 a/ ?3 r( X6 F }
" h9 I1 [( B2 S$ |0 o }
$ D7 y5 N& z/ A$ d. a- S1 J% Y: a2 u; E6 V6 o8 H" n+ g. h
return true;
4 n. i/ l3 c2 w}
6 {$ ]/ |: q. Q0 q. F' w' I
修改为
1 Y. r) [' y( ^' j& P; d3 r9 Mprivate function _xss_check() {
& q- v, f F2 w
$temp = strtoupper(urldecode(urldecode($_SERVER['REQUEST_URI'])));
9 b5 J* u/ c9 C/ g/ B if(strpos($temp, '<') !== false || strpos($temp, '"') !== false || strpos($temp, 'CONTENT-TRANSFER-ENCODING') !== false) {
$ S* g! W6 E3 ^9 c
system_error('request_tainting');
1 T1 `$ \3 a8 T/ @! x% f C
}
1 e# L! J! |9 I2 Y/ u
return true;
% j/ C1 Y2 d4 `' U7 Y2 Y, X3 U) P}
' t+ y& g% s* `+ Q0 f' p