I am using Tank Auth for user authentication. I am using the database to store sessions and using $this->auth->tank_auth->is_logged_in() to check if user is logged in. HMVC is also used, where auth module contains tank_auth.
Problem: It seems that some browsers cannot successfully log in into the website, including IE8, Chrome 15.0.874.121. Earlier versions of Chrome and IE are able to login. I did a trace of redirects and found out that upon logging in, the user is redirected to the main page, where the check is_logged_in() fails and redirects the user back to the login back. Anyone knows the problem?
Config.php
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
CI Controller Code
function index() {
$this->load->module('auth');
if(!$this->auth->tank_auth->is_logged_in()) {
redirect('login');
}
$this->load->view('main');
}
I have seen problems with this before where it only works in some browsers. I can not find the link but I read somewhere that it is the varchar size of useragent in DB that causes the problem. The solution was to make it larger.
Maybe this will help
http://codeigniter.com/forums/viewthread/197101/