虎泰克博客

网站存在SQL注入漏洞(盲注)的解决方法


从360网站安全检测那里知道网站存在SQL注入漏洞(盲注)后我就开始着手解决这个问题,xss无非就是

从360网站安全检测那里知道网站存在SQL注入漏洞(盲注)后我就开始着手解决这个问题,xss无非就是在网页中插入了恶意代码,然后浏览器执行的时候就会把恶意代码执行出来。 对此我的解决方法是创建一个函数将用户输入内容中的“<”以及“>”转换为实体字符。函数名为str_handle($str);$str为需要处理的用户输入的字符串。 function str_handle($str){ $str = str_replace("<","<",$str); $str = str_replace(">",">",$str); return $str; } 在发表文章的程序中处理方式如下: $title = str_handle($_POST['title']); $content = str_handle($_POST['content']); 这样一来就防止了恶意代码的执行。


Statement: all articles / drawings reproduced on this website are for the purpose of transmitting more information and facilitating discussion, which does not mean that the website, the host and the organizer agree with their opinions or confirm the authenticity of their contents. The contents of the articles are for reference only. If the rights of the original author are violated, please contact the website administrator.

Sign in to comment

Comment list

    No data