Welcome Guest, Not a member yet? Register   Sign In
A little confusion about security
#2

I hope I understand your question correctly, I think you could use the xss_clean() for this job. It will allow you to populate the inputs in your form with the (unescaped) posted data and then have xss_clean() filter the entire output before sending it back to the browser.


PHP Code:
// insert your form validation code

if ($this->form_validation->run() == FALSE) {
    
    
// Form either not valid or no post at all
    $form  $this->load->view('form'$viewdatatrue);

    if ($this->input->server('REQUEST_METHOD') == 'POST') {
        // Only use XSS clean if there actualy is some POST data to filter
        $filtered $this->security->xss_clean($form); 
        echo $filtered;
    } else {
        echo $form;
    }
} else {

    // form input was succesfully validated


Reply


Messages In This Thread
A little confusion about security - by Urastor - 09-06-2015, 12:37 PM
RE: A little confusion about security - by Diederik - 09-07-2015, 04:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB