[eluser]xwero[/eluser]
i use following method to check if the login is valid
Code:
function valid_login($username,$password)
{
$query = $this->db->select('password')->from('users')->where('username',$username)->get();
if($query->num_rows() == 0)
{
return false;
}
else
{
$this->load->library('encrypt');
foreach($query->result as $row)
{
if($this->encrypt->decode($password) == $row->password)
{
return true;
}
}
return false;
}
}
note : this works only in php5. for php4 you need to split the building of the query statement and use result_array in the loop.