CodeIgniter Forums
Cookies inside/outside Codeigniter - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: Cookies inside/outside Codeigniter (/thread-22177.html)

Cookies inside/outside Codeigniter - El Forum - 08-31-2009

Maybe someone can help me out on this one.... I'm forced to make a user browse outside of the codeigniter system. Inside of a controller i'm doing setcookie('test','test value'); Outside of the controller (example.php) i'm doing echo $_COOKIE['test'] but the cookie doesn't appear to be set. Does codeigniter obscure cookie names, why can't i transfer cookie values outside of the codeigniter system?

What would be an even better solution:
The third party application (outside of codeigniter) thats needed has a function called GetUserID(){} where i'm supposed to hook in my code to grab the userid from the cookie. Is there a way to do GetUserId(){ include('codeigniter.. something'); } So i could use the codeigniter session & possibly get the userId this way?

As of now i have the controller setting the cookie and then forwarding the user to the page outside of codeigniter. On the page outside of codeigniter i'm trying to read in the cookie with no luck.

Thanks for your thoughts/comments

Cookies inside/outside Codeigniter - El Forum - 08-31-2009

it probably has something to do with the folder structure...

if your CI part is in

then the cookie path was probably set as ci/ and you are trying to access a cookie with a default path of /

if you use firefox go to Privacy-> show cookies and search for your site and see where the cookie is actually at

just my guess..

Cookies inside/outside Codeigniter - El Forum - 08-31-2009

You the man, i was under the assumption not providing a PATH parameter to setcookie meant the cookie was available for the whole domain... but i got skooled. Thanks!!

Cookies inside/outside Codeigniter - El Forum - 08-31-2009

Curious why you're forced to direct the user outside of your CI install?