您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php过滤sql注入关键词分析

2024/8/8 1:43:41发布40次查看
1.使用mysql_real_escape_string代替 addslashes对输入进行转义2.字段值两边加上单引号
str_replace替换sql 中的 update 这种做法本身就是错误的, 原因如下:
如果sql中本来就有update字段,如以下的sql
 代码如下 复制代码
$sql = update content = 'update your name ..' where userid=1
那么,你用str_replace替换的后果是什么? 只要用户提交的内容中包含有update,
delete, alter均被篡改?这是多么可怕的事!!!
那么正确的办法是什么呢?
 代码如下 复制代码
$content = mysql教程_real_escape_string($content);
$sql = update content = '$content' where userid=1
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product