|
|
解决方案:
-修复的基本思路:
限制用户输入的CR和LF,或者对CR和LF字符正确编码后再输出,以防止注入自定义HTTP头。
-PHP语言的解决方案:
这种现象往往表现在带有参数传递的网页,只要合理的过滤好就OK啦,PHP语言的一些过滤方法:
$post = trim($post);
$post = strip_tags($post,""); //清除HTML等代码
$post = ereg_replace("\t","",$post); //去掉制表符号
$post = ereg_replace("\r\n","",$post); //去掉回车换行符号
$post = ereg_replace("\r","",$post); //去掉回车
$post = ereg_replace("\n","",$post); //去掉换行
$post = ereg_replace(" ","",$post); //去掉空格
$post = ereg_replace("'","",$post); //去掉单引号 |
|