Welcome Guest, Not a member yet? Register   Sign In
Session problem when upgrade 2.x to 3.0.x
#1

(This post was last modified: 10-13-2015, 04:32 PM by trinh.thanh.long.)

Excuse me, everyone. I met an issues and need all your helps.

I upgraded CI from 2.1.4 to 3.0.1 and Session makes me crazy. I implemented "Remember me" function with the below code in CI 2.1.4.

Code:
           if ($remember) {
               $this->session->set_userdata('new_expiration',60 * 60 * 24 * 31);
               $this->session->set_userdata('new_sess_expire_on_close',FALSE);
               $this->session->sess_update();//it available in 2.1.4 but in 3.0.x
           }else{
               $this->session->unset_userdata('new_expiration');
               $this->session->unset_userdata('new_sess_expire_on_close');
               $this->session->sess_update();//it available in 2.1.4 but in 3.0.x
           }

After upgrading to 3.0.1, the sess_update() function has been removed from Session class. Therefore, the error occurs. Of course the error does not appear in case I comment
Code:
$this->session->sess_update();
, but "Remember me" function has been failed.
I have searching for a while but cannot see the equivalent function for
Code:
sess_update();
in CI 3.0.x.

Does anyone has ideas about it.

Thanks and regards!
Reply
#2

Did you try it without the sess_update() call? As far as I can tell, it should no longer be necessary.
Reply
#3

What do you means, mwhitney? Which function I could use without the sess_update()?
Reply
#4

Just take sess_update() out of your code (it's no longer a valid function anyway) and see if your code works properly without it.

If you really need similar functionality to sess_update(), the closest thing I can think of is sess_regenerate().
Reply
#5

(This post was last modified: 10-14-2015, 05:44 PM by trinh.thanh.long.)

Thanks for your response, mwhitney.

As I described above, when I took sess_update() out of my code, It runs without errors but my function "Remember me" failed. I set
Code:
$config['sess_expiration'] = 0;
in config file, it means cookies will be invalid when closing the browser. When
Code:
$remember
variable is true (code above), I want to update sess_expiration to 1440 (for ex.). How I can do this?
Reply
#6

I've fixed the problem. Thanks for your response!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB