sql万能注入语句

1.针对有单引号的情况 : 万能密码 : select * from users where username='xxxx' and password='xxxxxx' or 1='1'; 万能用户名 : select * from users where username='xxxx' union select * from users/* and password='xxxxx'; 防止第一种万能密码 : 设置 php.ini 中的 magic_quotes_gpc = On ; 2.没有单引号的情况 : 万能密码 : select * from users where username=数字 and password=数字 union select * from users; 万能用户名 : select * from users where username= 数字 union select * from users/* and password=数字; 3.搜索SQL注入的情况 : 防止查询SQL的攻击,对关键字进行过滤 : //当php.ini中magic_quotes_gpc开启时,不要使用addslashes,否则会造成双重转义

$keyword = addslashes($keywords)

$keyword = str_replace("%","%",$keywords);

$keyword = str_replace("_","_",$keywords);

$sql= "select * from users where username like '%$keyword%'";

转载于:https://my.oschina.net/zichen/blog/103990

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值