form validation help PLEASE |
[eluser]dadamssg[/eluser]
im trying to get a simple login to work with a callback function i created to make sure the password the person entered matches a username they entered in a form. right now if i leave the fields blank and push submit i get "Empty fields", which is right. But if i enter something in both...i get "It WORKED."...which it doesn't work. The username and password im entering do not match so it should return FALSE. any help please? Code: <?php
[eluser]JHackamack[/eluser]
A few things, Have you tried renaming username_check to "verifyuser" something without the underscore. Also when the user put in their initial password did you md5 it?
[eluser]dadamssg[/eluser]
hey thanks for the reply but yes i just tried something with no underscore with no avail and yes the passwords are md5'ed. I don't know what the heck im doing wrong...
[eluser]JHackamack[/eluser]
In looking at the example I can see one difference that might affect it: Example Code: $this->load->library('validation'); $rules['username'] = "required"; $rules['password'] = "required"; $rules['passconf'] = "required"; $rules['email'] = "required"; $this->validation->set_rules($rules); Your Code $this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean|callback_username_check'); $this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|'); The bottom rule might be overwriting the top rule when it processes it, so you lose the username_check. Try setting as an array first
[eluser]dadamssg[/eluser]
im pretty sure that part is right...this is also in the user guide which is what i was referencing when i wrote it $this->form_validation->set_rules('username',username','trim|required|min_length[5]|max_length[12]|xss_clean'); $this->form_validation->set_rules('password', 'Password', 'trim|required|matches[passconf]|md5'); $this->form_validation->set_rules('passconf', 'Password Confirmation', 'trim|required'); $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
[eluser]dadamssg[/eluser]
for whatever reason it won't let me use my callback function i created...FRUSTRATING
[eluser]JHackamack[/eluser]
Are you referencing the current documentation? http://www.codeignitor.com/user_guide/li...ation.html Because also the current documentation also calls your "form_validation" just "validation"
[eluser]dadamssg[/eluser]
http://ellislab.com/codeigniter/user-gui...#callbacks thats what im referencing...its in their user guide..it SHOULD be current
[eluser]JHackamack[/eluser]
This might be more of a my error not checking out everything. I guess I messed up on that one, thats a my bad. Can you be sure that the username_check function isn't firing off, or that it might be querying incorrectly. As in putting a echo $this->db->last_query(); die(); to see if its getting to the username_check validation?
[eluser]dadamssg[/eluser]
hmm good idea...yeah its not pulling up that query. wtf |
Welcome Guest, Not a member yet? Register Sign In |