We have share how to implement XSS filter in codeigniter. XSS stands for cross-site scripting. CodeIgniter comes with XSS filtering security.There are some cross-site scripting hack prevention filters in CodeIgniter. It is used to disable JavaScript or other types of code that try to hijack cookies and perform other type of malicious activities. CodeIgniter has a built in XSS filter which is initialized automatically.

Syntax:

Load “security” class in controller.

Executing “xss_clean” function using security class.

Create a controller file like contactus.php inside “application/controllers” folder.

Create a View File like index.php inside “application/views/contactForm folder.

Note: For example, enter values in this form fields using tag, you will get a alert message, which is encountered by post method.

Demo   Download

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">