Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 代码点火器xss_清洁问题_Php_Codeigniter_Xss - Fatal编程技术网

Php 代码点火器xss_清洁问题

Php 代码点火器xss_清洁问题,php,codeigniter,xss,Php,Codeigniter,Xss,在codeigniter中,$this->input->post()(使用xss_clean=true) 给出这个输出 [removed]alert&#40;'Hello'&#41;[removed] 对于此输入字符串 <script>alert('Hello')</script> 到 $str=preg#u replace(“##si”,”$str); 它起作用了 我只是想问,是否有其他方法可以在不更改系统文件的情况下执行此操作 另外, 我应该使用

在codeigniter中,
$this->input->post()
(使用
xss_clean=true

给出这个输出

[removed]alert&#40;'Hello'&#41;[removed]
对于此输入字符串

<script>alert('Hello')</script>

$str=preg#u replace(“##si”,”$str);
它起作用了

我只是想问,是否有其他方法可以在不更改系统文件的情况下执行此操作

另外,


我应该使用
codeigniter
xss\u clean
函数吗?

是,尝试从CI\u安全性扩展类并编写新函数:

protected function\u do\u never\u allowed($str)

这将是更面向对象的方式

编辑:

CodeIgniter允许您扩展核心类。请参阅此链接:


您不应该编辑核心文件

相反,您应该从应用程序扩展安全类

在./application/core中创建一个名为“MY_Security.php”的文件,并扩展安全类

$str = preg_replace("#<(/*)(script|xss)(.*?)\>#si", '[removed]', $str);  
$str = preg_replace("#<(/*)(script|xss)(.*?)\>#si", '', $str);