my validations are working ok but after that userid and password results empty in model fit_reg_model and it results into authentication failed.please help me out.
this is my code :
model fit_reg_model
`
class Ftg_reg_model extends CI_Model {
public function log_valid( $userid, $password )
{
$this->db->select("regID,loginCode");
$whereCondition = $array = array('regID' =>$userid,'loginCode'=>$password);
$this->db->where($whereCondition);
$this->db->from('fit_1login');
$query = $this->db->get();
////////////////////////////////checking values////////////////////
echo"";
print_r ($query->result()); exit;
return $query->row()->countID;
if( $query->num_rows() )
{
echo"";
print_r ($query->result()); exit;
return $query->row()->countID;
//return TRUE;
}
else
{
return FALSE;
}
}
}
contrller fit_ci
` public function fit_loguser()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('uname','User Id','required|valid_email|valid_emails|trim');
$this->form_validation->set_rules('password','Password','required|trim');
$this->form_validation->set_error_delimiters("","
if($this->form_validation->run() )
{
$userid = $this->input->post('uname');
$password = $this->input->post('password');
//////////////////////////////////////loding model////////////////
$this->load->model('ftg_reg_model');
//echo $userid , $password;
if( $this->ftg_reg_model->log_valid('$userid','$password')== True )
{
//$this->load->view('fitasy/fit_userprofile');
$this->load->library('session');
$this->session->set_userdata('id',$id);
echo "Successful loged";
}
else
{
echo "Authentication failed";
}
}
else
{
$data['title'] = 'Fit';
$this->load->helper('form');
$this->load->view('fit/index.php',$data);
}
}
`
view fit_loguser
`
Login here to add items to your Cart
'form-horizontal'])?>
'uname','class'=>'form-control','placeholder'=>'Username','value'=>set_value('uname')])?>
'password','class'=>'form-control','placeholder'=>'Password'])?>
'logsubmit','class'=>'btn btn-default','value'=>'Proceed','type'=>'submit'])?>
No comments:
Post a Comment