The codeigniter form validation library provides the option to 'prep' data from a form that is being validated. The following is a snippet from the documentation:
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]|xss_clean');
The xss_clean
parameter at the end supposedly passes the post data through the xss_clean
function.
I am wondering how then do I use the POST data 'username'? Did the xss_clean
function act directly on the POST variable so that I may then do: $username = $this->input->post('username');
and actually get the filtered data? What if I place that last statement before the validation line: will $username contain unfiltered data in this case? Thanks.