帝国cms源码开发的时候很多时候要用到$_GET过来的参数,在处理的时候如果不严谨容易被发现利用,给系统整体安全带来影响。
帝国cms系统本身有自带了过滤函数RepPIntvar,传递过来的字段加上过滤可以给安全加分。
错误的写法:$title = $_GET['id'] ; 未经过滤存在SQL注入漏洞风险
正确的写法:$title = RepPIntvar($_GET['id']); 对传过来的字段进行过滤。
这样在一些安全检测上会加分,不会存在检查SQL注入漏洞。
帝国CMSRepPIntvar()
function RepPIntvar($val){
$val=intval($val);
if($val<0)
{
$val=0;
}
return $val;
}
函数 RepPIntvar()
功能 将变量值转为正值得整形。
位置 e/class/connect.php
版本 7.0

Hi, this is a comment. To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard. Commenter avatars come from Gravatar.