Welcome Guest, Not a member yet? Register   Sign In
Validation md5 not working
#1

[eluser]Loquela[/eluser]
Hi there,

For some reason, the md5 is not converting the email input and the data is submitted as plan text. Everything elseworks, validation is working - I'm sent back to the form on falure and the data is inserted on success. Just the md5 function in the password field doesn't seem to be doing anything.

Any ideas?

Cheers

Code:
$this->form_validation->set_rules('username', 'Username', 'required');
        
        $this->form_validation->set_rules('password', 'Password', 'matches[passconf]|md5');
      
        $this->form_validation->set_rules('passconf', 'Retype password');
        $this->form_validation->set_rules('firstname', 'Firstname', 'required');
        $this->form_validation->set_rules('lastname', 'lastname', 'required');
        $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
        
        $data = array(
            'username'  =>$this->input->post('username'),
            'password'  =>$this->input->post('password'),
            'firstname' =>$this->input->post('firstname'),
            'lastname'  =>$this->input->post('lastname'),
            'email'     =>$this->input->post('email'),
            'updated'    =>$this->input->post('updated'),
        
        );
        
        
        if($this->form_validation->run()==FALSE)
        {
            $this->update_admin_form($data);
        }
        else
        {
            $this->users_model->update_user($data);
            $this->update_admin_form($data);
        }
    }
#2

[eluser]danmontgomery[/eluser]
md5 only gets applied on the successful completion of $this->form_validation->run(), so you would need to declare the $data array after that call.

Code:
if($this->form_validation->run()==FALSE)
{
  ...
}
else
{
  $data = array(
   'username'  =>$this->input->post('username'),
   'password'  =>$this->input->post('password'),
   'firstname' =>$this->input->post('firstname'),
   'lastname'  =>$this->input->post('lastname'),
   'email'     =>$this->input->post('email'),
   'updated'    =>$this->input->post('updated'),
  );

  $this->update_admin_form($data);
}
#3

[eluser]Loquela[/eluser]
Thanks nocturn,

that did the trick.

L.




Theme © iAndrew 2016 - Forum software by © MyBB