Welcome Guest, Not a member yet? Register   Sign In
CI Sessions - No user data
#1

[eluser]robjstanley[/eluser]
Hey,

I have a problem to do with CI Sessions. I have a login section which creates a users login and all is fine while under the userpanel controller.

If a user clicks outside that controller, say for instance back to home a new session gets generated with all the same information such as browser, ip etc but no user data.

The problem with this is that this session seems to take over the previous and i have no access to the user who is logged in as the session userdata is null.

Ive been trying to figure out why CI is creating this session and where it could be coming from but i have no idea.

Has anyone experienced something like this before? or any tips on resolving or finding problem.

Any help would be greatly appreciated.
#2

[eluser]robjstanley[/eluser]
Even if there was a way to work out where the session is being set i could find the problem but if i remove all sections of my code where a session is set i still find it creates one.
#3

[eluser]toopay[/eluser]
Have you check your configuration of "Session Variables" section at your config file?
#4

[eluser]robjstanley[/eluser]
Code:
$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 7200;
$config['sess_encrypt_cookie']    = TRUE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']     = 300;

$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']        = "/";

that is what i have set.
#5

[eluser]robjstanley[/eluser]
Is there something i'm missing or do sessions in CI not spread over all controllers? it only works over the controller it was initialised in.
#6

[eluser]toopay[/eluser]
are you set your session in autoload?
#7

[eluser]robjstanley[/eluser]
Yes
#8

[eluser]toopay[/eluser]
so, that must answer your question "...but if i remove all sections of my code where a session is set i still find it creates one."

Now, your problems i believe is : whenever you attempt to save some variable to session userdata, it simply not save that. Hmm, i've experiencing same issues several month ago, and i found something wrong with my server host (in other word, environment issues). The session lib only work if i set $config['sess_expiration'] to '80000' or simply '0'.
#9

[eluser]robjstanley[/eluser]
I don't think you understand what i mean.

CI is creating a session, without me actually typing
Code:
$this->session->set_userdata();
#10

[eluser]toopay[/eluser]
I know what you mean. If you setting session in autoload, that mean everytime you load a controller, CI will create a session, with minimal data (ip address, browser, sess id, ts).

userdata, is different problems. You using $this->session->set_userdata(), to save some variable in session array section, which called 'userdata'. And in your case, everytime you attempt to save some variable in it, failed. Right?




Theme © iAndrew 2016 - Forum software by © MyBB