function validate_credentials(){
if(is_numeric($this->input->post('username')))
{
$this->form_validation->set_rules('username','Mobile','trim|required|xss_clean|min_length[10]|is_unique[fi_login.mobile]|callback__check_valid_username');
}
else if($this->form_validation->set_rules('username','Email','trim|required|xss_clean|valid_email|is_unique[fi_login.email]'));
$this->form_validation->set_rules('password','Password','trim|required|xss_clean');
if($this->form_validation->run() == FALSE){ //didn't validate
$this->index();
}
else{
$this->load->model('login_signup_model');
/* $data=array(
'email' => ,
'mobile' => ,
'password' => ,
); */
if($this->login_signup_model->login_validate()){
$this->session->set_userdata();
redirect('homepage');
}
}
}
if(is_numeric($this->input->post('username')))
{
$this->form_validation->set_rules('username','Mobile','trim|required|xss_clean|min_length[10]|is_unique[fi_login.mobile]|callback__check_valid_username');
}
else if($this->form_validation->set_rules('username','Email','trim|required|xss_clean|valid_email|is_unique[fi_login.email]'));
$this->form_validation->set_rules('password','Password','trim|required|xss_clean');
if($this->form_validation->run() == FALSE){ //didn't validate
$this->index();
}
else{
$this->load->model('login_signup_model');
/* $data=array(
'email' => ,
'mobile' => ,
'password' => ,
); */
if($this->login_signup_model->login_validate()){
$this->session->set_userdata();
redirect('homepage');
}
}
}
hello and thanks for this article :)
ReplyDeleteThe fact experimented code did not give me any error but also did not give any change