[eluser]LexXx[/eluser]
Hello Word to all
I just begin my project with codeigniter and problems just started.
I have library file and function login:
Code:
public function login()
{
$this->CI->load->model('user');
if($this->CI->user->login_check() == true) // if the user's credentials validated...
{
$email = $this->CI->input->post('email');
$password = md5($this->CI->input->post('password'));
$data['user_info'] = $this->CI->user->get_user_data($email, $password);
print_r($data['user_info']);
die();
}
else // incorrect username or password
{
$data['heading'] = "Wrong email adress or password combination";
$data['message'] = "Ooouchhh you just enter wrong email adress or password combination<a >CLICK HERE</a> to try again.<br />";
}
}
Controller is not finished:
Code:
public function login()
{
$this->authentication_lib->login();
}
couse my problem is in model
Code:
public function login_check()
{
$this->db->where('email', $this->input->post('email'));
$this->db->where('password', md5($this->input->post('password')));
$query = $this->db->get('users');
if($query->num_rows == 1)
{
return true;
}
else
{
return false;
}
}
public function get_user_data($email, $password)
{
$this->db->where('email', $this->email);
$this->db->where('password', $this->password);
$query = $this->db->get('users');
if($query->num_rows == 1)
{
foreach($query->result() as $row)
{
$data[] = $row;
}
return $data;
}
}
i try to send 2 argument from lib
Code:
$email = $this->CI->input->post('email');
$password = md5($this->CI->input->post('password'));
$data['user_info'] = $this->CI->user->get_user_data($email, $password);
and i have in called model
Code:
public function get_user_data($email, $password)
{
//code
}
always have error
Message: Undefined property: Authentication::$email
Filename: core/Model.php
Line Number: 51
Message: Undefined property: Authentication::$password
Filename: core/Model.php
Line Number: 51
Can anyone help me???