I'm using CKEDITOR and ajax to post news in a website I've created.
Everything works just fine, but apparently when I send text containing style="display:none", for example, when posting I get a 403 error. It doesn't happen If I remove that line or change letters like style="misplay:none"
Here is my code
PHP
$title=$this->input->post('title');
$body=$this->input->post('body');
$published=$this->input->post('published');
$tags=$this->input->post('tags');
Ajax call
$.ajax({
url: '/reviews_aj/addreviews',
type: 'POST',
data: {'title':title,'body':body,'published':published,'tags':tags},
success: function(result){
...
}
});
The weirdest part is that the addreviews function is actually called but $_POST seems to be empty and a 403 error is returned.
This is what's being sent
id=18&title=asdasdas&body=style%3D%22display%3Anone%22&published=false&tags=
var_dump($_POST); returns an empty array.
I've started to think that the problem is Jquery, somehow converting special chars the wrong way (and messing with the uri rerouting of Codeigniter. But I don't really know
EDIT for @shershams You asked me to try this.
var temp = {'title':title,'body':body,'published':published,'tags':tags};
console.log( JSON.stringify(temp, undefined, 4) );
This is the output
{
"title": "style=\"display:none\"",
"body": "<p>\n\tasdasd</p>\n",
"published": false,
"tags": ""
}
Looks exactly to what I expected
EDIT:
Just noticed that sending it through a simple POST (not ajax, a simple form) wont work either.
EDIT:
style='display:none' with single quotes works, I don't control CKEDITOR's output though, it should work with both double and single quotes