drlnsli18864734 2017-08-13 02:32
浏览 168
已采纳

CSRF Codeigniter 3验证

I've been reading about the crsf protection in codeigniter, but I can't seem to find a decent tutorial on how to proceed after enabling csrf in the config file.

I have a form generated by a controller function users/create that submits to another function users/submit_new.

I used the form helper class so that the crsf field is automatically generated.

I have this validation function on the submit function:

if ($this->input->post(get_csrf_token_name()) == get_csrf_hash()) {
$this->users_model->create(); }

But all I get is action not allowed error. What is the right way to validate csrf? Or am I doing something wrong?

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试