0

I am using exact code as it is from here: https://ellislab.com/codeigniter/user-guide/libraries/form_validation.html

It all works great when csrf_protection in config file is set on false. But when I set it on true, and submit a form, I get an error:

An Error Was Encountered
The action you have requested is not allowed.

I tried to run code on Chrome 39 and on IE 8. It works on both. But on Firefox 34 it doesn't.

So apparently something is wrong with firefox 34? I googled about it but i didn't find anything. Then I ran some more tests on what is happening with csrf_hash. I put log_message('info', $this->security->get_csrf_hash()); in controller. And i found out that when i refresh (run) controller in Chrome and IE, csrf_hash does not change, it is changed just when i submit form and post is sent back to controller. In firefox csrf_hash is changed every time when controller runs.

In Log file, when i submit my form in fireofx, the last log is

[DEBUG - 2014-12-10 12:45:50 --> Input Class Initialized], next one would have to be [DEBUG - 2014-12-10 12:45:50 --> CRSF cookie Set] but it never came to that. So I suppose that on form submition in firefox, crsf cookie don't want to be set. Why in firefox but not in IE and Chrome?

I am new with codeigniter, and I am working on that problem for 3rd day now =(.

I would appreciate any help or hint with this. Thanks!

Dexter
  • 1,804
  • 4
  • 24
  • 53
Uroš Podkrižnik
  • 8,607
  • 5
  • 21
  • 31
  • its a bit old but does [this](http://stackoverflow.com/a/1877996/1564365) help? Try to set up CodeIgniter to your local IP 192.168.x.x instead of localhost or edit hosts file (google it). – Kyslik Dec 12 '14 at 09:36
  • 2
    **Its cookie issue** `clear cookies of your firefox(not all, just the domain you are working on)` and then visit the page. **ELSE** `use private browsing for testing purpose` – Karan Thakkar Dec 12 '14 at 09:42
  • @Kyslik that doesnt help but thank anyway – Uroš Podkrižnik Dec 12 '14 at 09:55
  • @karan thakkar THANK you so much! It realy was a cookie issue in firefox. It is not my default browser so i didn't know that in firefox privacy settings "accept cookies from sites" was not checked. I feel very stupid now =D. Thanks! – Uroš Podkrižnik Dec 12 '14 at 10:00

0 Answers0