//从数据库获取该用户的信息
$info = $this->get($user_name, true);
//比对用户密码,若不等则返回0,否则返回用户id
if ($info['password'] != md5($password))
{
$this->_error('auth_failed');

return 0;
}

return $info['user_id'];