Welcome Guest, Not a member yet? Register   Sign In
how to use xss_clean?
#1

[eluser]my9006ci[/eluser]
hello there

i have problem with security input form about html code

i have input text with validation like this
Quote:$this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[12]|xss_clean');

when i input some text like code html like this
Quote:<div id="wrapper">

code igniter accept that code,but i dont wont code html insert into my database

the function xss_clean, i think not work...

so when user login, my web interface so like destroy

i dont like this condition...

in my code php native, i am always use strip_tags();

and how if used in codeigniter??

please help me
what can i do now...?
#2

[eluser]nelson.wells[/eluser]
You can still use strip tags in your form validation (and, in fact, any function that will accept one parameter). Do the validation like this and see if you get what you want

Code:
$this->form_validation->set_rules(‘username’, ‘Username’, ‘required|min_length[5]|max_length[12]|strip_tags|xss_clean’);
#3

[eluser]my9006ci[/eluser]
thanks nelson.wells, i try...




Theme © iAndrew 2016 - Forum software by © MyBB