您好,当我尝试使用代码点火程序登录时,我遇到了这个错误
The action you have requested is not allowed.这是我对csrf的配置:
$config['csrf_protection'] = TRUE;
$config['csrf_token_name'] = 'csrf_token_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;这是一个为魔兽世界仿真定制的内容管理系统,叫做FusionCMS,它使用php连接到一个MySQL数据库。
发布于 2012-10-12 03:10:28
您提交的每个表单都需要使用表单帮助器中的form_open('form_action_url'),以便CodeIgniter自动插入CSRF域。确保以这种方式打开表单,而不是通过<form method="POST" action="form_action_url">。
发布于 2012-10-12 13:43:37
您有两个选项as per this thread
将form_open()用作Form Helper的一部分。此函数将自动将csrf令牌生成为隐藏的<input>。
或者,将普通HTML与手动csrf令牌结合使用:
<form method='post' action='somecontroller'>
<input type="hidden" name="<?= $this->security->get_csrf_token_name()?>" value="<?= $this->security->get_csrf_hash()?>" >
<input .../>
</form>注意:如果你得到一个错误,指出get_csrf_hash()不存在,你可能使用的是旧版本的配置项,可以使用下面的代码:
<input type="hidden" name="<?= $this->security->csrf_token_name?>" value="<?= $this->security->csrf_hash?>" />https://stackoverflow.com/questions/12846738
复制相似问题