好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

xss注入应对办法 - 网站安全 - 自学php

php中的htmlspecialchars ()  这个函数,会把   htmlspecialchars() 函数把一些预定义的字符转换为HTML 实体。   预定义的字符是:   & (和号) 成为&amp; " (双引号) 成为&quot; ' (单引号) 成为&#039; < (小于) 成为&lt; > (大于) 成为&gt; 一旦,<script> 变成了&lt;script 这种格式,那这个js就不会被执行了  mysql防止注入 :   if (get_magic_quotes_gpc()) {     $name = stripslashes($name);     // stripslashes () 用于清理从 数据库 或其它地方,获取的数据中。由addshashes 添加的" \ "     }else{     $name = mysql _real_escape_string($name);  // mysql_real_escape_string () 主要是对' 和" 进行转义     }   另外,mysql同一个查询里,不能执行两条语句。 比如mysql_query('select * from table1;drop table b;');     这样是不行的   摘自 山里人家

查看更多关于xss注入应对办法 - 网站安全 - 自学php的详细内容...

  阅读:43次