[SOLVED] Avoid POST data escaping |
Hi CodeIgniters !
I need your help on a hard point for me here... Let me explain. I run on a project which needs to store XML data in database, data is JS generated and AJAX saved to DB. Here is the code : Main Controller PHP Code: public function create() Javascript Code: $(function() { Model PHP Code: public function setXML($id, $type, $value) The problem is that I end with an XML formatted string like this one : Code: <?xml version='1.0' encoding='UTF-8'?><instruction><question id='1'><request><object type='text'>Question ?</object></request><response><object type='radio'><option value='1'>Yep</option><option value='2'>Nope</option></object></response></question></instruction> And the result of the alert is obviously : "Disallowed Key Characters." ____________ From that consideration, I thought overriding the Input class would make it ! I tried to make a MY_Input class into my app/core folder, it looks like this for now : PHP Code: <?php if(!defined('BASEPATH')) exit('No direct script access allowed'); Here I'm a little lost because I keep needing this POST array made, but without running the _clean_input_keys function ! So I don't know how to make it, that's the point... If someone could help me, it would be really really nice I know it'll make a security lack, but I tried to make it safiest as possible with the config value.
You can first try to add this parameters to you jquery ajax call:
PHP Code: contentType: "text/xml",
I cancelled my overide of Input class to get the POST data with native PHP $_POST["xml"], but I had still the same message "Disallowed Key Characters." ! So I checked DB classes but couldn't find this message in code.
The Controller is now like this : PHP Code: public function saveXML() @Rufnex : Thanks for your answer, I tried it but nothing happened so I added the error handler to AJAX and it's on error. Here is the AJAX Code: $.ajax({ I don't think I messed up with the model so I can't figure it out... I will continue to investigate. |
Welcome Guest, Not a member yet? Register Sign In |