[eluser]wiredesignz[/eluser]
Mine is almost identical to xwero
Code:
function try_login($attempt) //$attempt is an object
{
if ($attempt->password)
{
//find user, check password & create cookie if valid
if ($user = $this->users->findBy("`username` = '{$attempt->username}'") AND $attempt->password == $this->encrypt->decode($user->password))
{
set_cookie('ci_user', $user->uid, 0); //cookie expires on browser close
if ($attempt->remember) set_cookie('ci_login', $user->uid, 86500);
return TRUE;
}
}
return FALSE;
}