Welcome Guest, Not a member yet? Register   Sign In
aren't cookies global?
#8

I was actually referring to the code you wrote has apostrophes out of place and additional brackets.

But something is up because yes, your session values will be available in all your models, libraries and controllers, and a single session has only one session array.

When you say you store the userid in the cookie using the cookie helper, that cookie will not update until the page is loaded at the browser end. So you cannot then read it again in the same server session. What you would have to do is have an intermediate thank you page of some sort with a click here to continue button or similar. Then your new value of the cookie will be available to be read. Loading the cookie library twice is not important here as I believe CI will know it has already been loaded and ignore that.

If you load a value into the session
PHP Code:
$_SESSION['user_id'] = $userid
Then that session value will be available after a redirect.

You can check the profiler to see what is in the session variable.
PHP Code:
$this->output->enable_profiler(TRUE); 

Hope that helps, you seem to have a complicated issue here that is hard for us to replicate easily.

Paul.
Reply


Messages In This Thread
aren't cookies global? - by richb201 - 11-09-2017, 02:24 PM
RE: aren't cookies global? - by neuron - 11-09-2017, 11:40 PM
RE: aren't cookies global? - by richb201 - 11-10-2017, 01:51 AM
RE: aren't cookies global? - by dave friend - 11-13-2017, 09:47 AM
RE: aren't cookies global? - by InsiteFX - 11-10-2017, 05:12 AM
RE: aren't cookies global? - by richb201 - 11-11-2017, 11:28 AM
RE: aren't cookies global? - by PaulD - 11-11-2017, 12:29 PM
RE: aren't cookies global? - by richb201 - 11-11-2017, 12:43 PM
RE: aren't cookies global? - by PaulD - 11-11-2017, 12:55 PM
RE: aren't cookies global? - by richb201 - 11-13-2017, 10:56 AM
RE: aren't cookies global? - by dave friend - 11-13-2017, 02:42 PM
RE: aren't cookies global? - by richb201 - 11-13-2017, 03:15 PM
RE: aren't cookies global? - by dave friend - 11-13-2017, 06:29 PM
RE: aren't cookies global? - by richb201 - 11-14-2017, 03:53 PM
RE: aren't cookies global? - by InsiteFX - 11-15-2017, 03:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB