网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的考试资料:

 

标题 dedecms投票模块漏洞解决方法
内容
    dedecms投票模块有朋友反映投票主题的选项经常被sql注入删除,经过ios100知识库查看代码发现投票模块代码没有对sql参数进行转换,导致不法分子sql注入。只要将addslashes()改为mysql_real_escape_string()即可。
    打开/include/dedevote.class.php文件,查 找$this->dsql->executenonequery(update `dede_vote` set totalcount='.($this->voteinfos['totalcount']+1).',votenote='.addslashes($items).' where aid='.$this->voteid.');
    修改为
    $this->dsql->executenonequery(update `dede_vote` set totalcount='.($this->voteinfos['totalcount']+1).',votenote='.mysql_real_escape_string($items).' where aid='.mysql_real_escape_string($this->voteid).');
    注:
    * addslashes() 是强行加\;
    * mysql_real_escape_string() 会判断字符集,但是对php版本有要求;(php 4 >= 4.0.3, php 5)
    * mysql_escape_string不考虑连接的当前字符集。(php 4 >= 4.0.3, php 5, 注意:在php5.3中已经弃用这种方法,不推荐使用)
随便看

 

在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/17 20:51:27