Welcome Guest, Not a member yet? Register   Sign In
set_userdata doesn't realy set userdata
#1

Hi,

I'm using a modified version of the very basic user authentication library (https://github.com/joelvardy/Basic-CodeI...entication) for the authentication in my application.

It was working well until I did an upgrade to CI3 RC2, after that upgrade the userdata isn't set.

PHP Code:
$user_details $user->row();
 
// Set the userdata for the current user
$this->ci->session->set_userdata(array(
'identifier' => $user_details->identifier,
'username' => $user_details->email,
'logged_in' => $_SERVER['REQUEST_TIME']
)); 

I use the database driver with the following configuration

PHP Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'session'//my sesion table
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300

Does someone know what I am doing wrom?
Reply
#2

Your sessions table may need to be modified since the table schema for sessions changed in CI 3: http://www.codeigniter.com/userguide3/li...ase-driver

MySql example:

Code:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
      `id` varchar(40) NOT NULL,
       `ip_address` varchar(45) NOT NULL,
       `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
       `data` blob DEFAULT '' NOT NULL,
       PRIMARY KEY (id),
       KEY `ci_sessions_timestamp` (`timestamp`)
);

Note that the `data` field is now a blob data type.
Reply
#3

My session table is exactly the same as the mysql example you gave. (I did that upgrade already).
Reply
#4

What does that description really mean? It's not saving to the database or ... ?

And how did you verify that? Did you look at the logs?
Reply
#5

I found what was wrong, I was trying to make a connection with the Joomla! CMS authentication, the Joomla! framework breaks the CodeIgniter session handler. When I comment the joomla imports it is working well.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB