我有一个标准的登录表单,将数据提交到Codeigniter函数以进行身份验证。问题是,数据似乎在到达函数之前就被剥离了HTML实体。现在,如果我错了,请纠正我,但我认为 config.php 中的参数仅与 Codeigniter 函数相关,即这将与$this>投入>帖子相关,而不是_POST美元。无论哪种方式,在我的配置中.php我都有
$config['global_xss_filtering'] = FALSE;
如果我提交表单,我在输入字段中提交的数据是:
$_POST['user'] = 'user';
$_POST['password'] = 'password%100';
作为参考,我的表单开始标签是:
<form method="POST" action="<?=site_url('/log-in')?>">
我已经完成了以下函数来测试数据:
echo "<pre>";
print_r($_POST);
echo sha1('userpassword%100') . '<br />';
echo sha1($_POST['username'] . $_POST['password']) . '<br />';
echo sha1($this->input->post('username', FALSE) . $this->input->post('password', FALSE)) . '<br />';
echo "</pre>";
它给出的输出为:
Array
(
[username] => user
[password] => password0
)
ad45e6412dd3cec23e47bbb48c874cdcfd6d39e7
fa3279bde5d6aba9ed77c6e5b071ff8dde741b92
fa3279bde5d6aba9ed77c6e5b071ff8dde741b92
所以顶部哈希是正确的,但传递的实际数据似乎从密码字段中去除了 html 实体,即 %10 - $_POST['password'] 应该是密码%100 不是密码0
谁能建议我如何获取正确的、未转义的数据?
提前感谢,基督教
我也遇到了几乎相同的问题,因为我使用 $_REQUEST 方法,它对我有用。请尝试此操作,希望对您有所帮助。
在/system/core/Input 的第 568 行.php将 remove_invisible_characters 函数移动到 $this->_enable_xss === TRUE
语句中。
以前:
// Remove control characters
$str = remove_invisible_characters($str);
// Should we filter the input data?
if ($this->_enable_xss === TRUE)
{
$str = $this->security->xss_clean($str);
}
现在:
// Should we filter the input data?
if ($this->_enable_xss === TRUE)
{
// Remove control characters
$str = remove_invisible_characters($str);
$str = $this->security->xss_clean($str);
}
希望对其他人有所帮助!