CodeIgniter Forums
set_cookie problem =/ ~ beginner - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: set_cookie problem =/ ~ beginner (/showthread.php?tid=36013)



set_cookie problem =/ ~ beginner - El Forum - 11-18-2010

[eluser]cehennem[/eluser]
I am trying to set a cookie like this;

set_cookie('username', $this->input->post('user'), 10); // 10 secs for test

it doesn't work for me.

But when I try higher values such as 5000, 30000 etc, it works nice (not sure when it's going to be expired)

I haven't post the full code coz of that interesting issue. It doesn't accept my small number of seconds.

Can somebody tell me whats wrong?


set_cookie problem =/ ~ beginner - El Forum - 11-18-2010

[eluser]mvdg27[/eluser]
My first ques would be that it has to do with a mismatch of the time on you local computer and on your server.

Let's say your server thinks the time is: 12:00:00, and set's a cookie with a 10 second time to live, and on you local PC the time at the same moment is set to 12:00:11, then the cookie will never exist ..


set_cookie problem =/ ~ beginner - El Forum - 11-18-2010

[eluser]cehennem[/eluser]
oh nice guess! my server time was about 2 hours back.. solved thanks Wink