CodeIgniter Forums
Reading flash cookie - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Reading flash cookie (/thread-21841.html)



Reading flash cookie - El Forum - 08-22-2009

[eluser]aryan_[/eluser]
How can I read flash cookie?

I'm using this code to create a cookie:

Code:
user = SharedObject.getLocal("user");
user.data.signedup = true;
user.flush();

and, accessing it using php:

Code:
$x = $_COOKIE['signedup'];

But, unable to access. It throws an error:
Message: Undefined index: signedup

How should I access the cookie created? Please help.


Reading flash cookie - El Forum - 08-22-2009

[eluser]Dark Preacher[/eluser]
Why don't you use CI session? It's easy enough, set variable in session via your model or controller like this:
Code:
$user = $this->session->userdata('user');
and use it like this in your views:
Code:
$x = $this->session->userdata('user')



Reading flash cookie - El Forum - 08-22-2009

[eluser]aryan_[/eluser]
Actually, I want one signup per machine. Flash cookie is global for all browsers, and difficult to delete. That's why I'm using it.

Do you have any idea?


Reading flash cookie - El Forum - 08-22-2009

[eluser]Dark Preacher[/eluser]
I think that you still can use CI session, but store them in DB and disable browser match, more info can be found in user guide
http://ellislab.com/codeigniter/user-guide/libraries/sessions.html