How do you remove ALL HTML tags with codeigniter? im guessing you would have to use the PHP function strip_tags, but I wanted something like the global setting for XSS filtering
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re referring to using the
inputmethods, Yes, you could technically open upsystem/libraries/Input.php, head down to this code:And right after the xss clean, you could put your own filtering function like so:
However this means that everytime you update CodeIgniter, you will have to make this change again. Also since this does all of this globally, it won’t make sense if the value you’re getting back is, say for example, numeric. Because of these reasons
Now for an alternative solution, you can use the CodeIgniter Form Validation library, which let’s you set custom rules for fields, including php functions that can accept one argument, such as
strip_tags:I’m not sure what the circumstances are, so I’ll let you decide which path to take, but in general I recommend handling data validation on a per case basis, since in a majority of cases the validation on the data is unique.