[eluser]Bionicmaster[/eluser]
Another comments, in _verify_cookie, you can use $userdata->row or $userdata->row_array() instead of result_array(), simplifying your indentifier in $identifier = $result->username . $result->token or $result['username'] . $result['token'], and is quickly code too.