Cookies inside/outside Codeigniter

#1
[eluser]graf[/eluser]
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

#2
[eluser]brianw1975[/eluser]
it probably has something to do with the folder structure...

if your CI part is in site.com/ci/controller/method/var

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..

#3
[eluser]graf[/eluser]
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!!

#4
[eluser]Aken[/eluser]
Curious why you're forced to direct the user outside of your CI install?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.