Welcome Guest, Not a member yet? Register   Sign In
Users Not Staying Logged In (A Note on Storing Session Data via $this->session->set_userdata)
#1

[eluser]Vik[/eluser]
I had a bug today where in tests a user wouldn't stay logged in. It turned out that when I added the username and email to the session userdata, using $this->session->set_userdata, I exceeded the 50 character field length of the user_data field in the sessions database. This was easy to fix by giving the user_data field a longer field length in the mySQL table.

I thought I'd note it here in case anyone else encounters a similar situation (or in case I want to look it up again later. Smile
#2

[eluser]xandesigns[/eluser]
I'm having this problem and extended the user_data field but the user still wont stay logged in when they visit another page on the site. =/
#3

[eluser]Vik[/eluser]
Are you running CodeIgniter 1.7.2? 1.7.1 had a glitch in it that could cause this anomaly, per another thread on this forum, IIRC.
#4

[eluser]xandesigns[/eluser]
not quite sure. but i fixed my problem. i went about it another way and it works now. spent hours trying to figure this out...ergh.
#5

[eluser]Vik[/eluser]
How did you fix it?
#6

[eluser]xandesigns[/eluser]
im pretty new to codeigniter and had the whole checking if a session existed wrong

if($this->session->userdata('logged_in') == TRUE)

thats how i fixed it. i was doing it a completely different way before and produced the error you mentioned. i dont think it was related to the problem you had though.
#7

[eluser]Vik[/eluser]
OK, thanks for the info.




Theme © iAndrew 2016 - Forum software by © MyBB