$this->input->post('question', TRUE)
If even I add TRUE, it still allows people to add html code. Why is that?
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.
The
xss_clean()function does not remove all HTML, it removes/replaces specific things that are considered dangerous, like<script>tags.Someone injecting a
<p>tag into your page, while maybe not desired, is not really an effective attack. You’ll have to specify what you want to do with it. In many cases, you will want HTML output that has beenxss_clean()ed.It sounds like you want either
htmlspecialchars()orstrip_tags()(note: these two very different things). If you want to encode the HTML, you can also use CI’shtml_escape():If you want HTML output and not entities, just use the XSS filter by itself: