Page 1 of 1

Cookies issue

Posted: Tue May 17, 2011 7:41 pm
by wasir
Hi

I have an internal web based system that is meant to show different results based on the computer it is viewed from. I am using cookies to achieve this.

Code: Select all

setcookie('cookieName', $cookieValue, time()+60*60*24*365*10, '/', '.websiteDomainName'); 
I've also edited group policy of each computer so that the user can not delete browsing history/cookies.

On most of the computers it's working great. But on couple of machines (on both XP and Vista) for some reason the cookies sometimes (not always) are not read by the website. One of the user also mentioned that after restarting the computer couple of times fixed the problem.

Has anyone experienced issues with cookies getting ignored by website?

Re: Cookies issue

Posted: Tue May 17, 2011 8:01 pm
by Benjamin
:arrow: Moved to PHP - Code

Re: Cookies issue

Posted: Wed May 18, 2011 8:51 am
by Jade
Have you checked the browser settings on those computers? Sounds like a browser issue to me -- perhaps try clearing their caches.

Re: Cookies issue

Posted: Wed Jun 22, 2011 5:46 pm
by wasir
Tried all that. no luck.

Re: Cookies issue

Posted: Wed Jun 22, 2011 7:51 pm
by Jade
Have you tried using sessions instead? Cookies are notorious for not working because of people's browser settings: http://php.net/manual/en/ref.session.php

Re: Cookies issue

Posted: Wed Jun 22, 2011 8:06 pm
by wasir
can't avoid cookie because the website needs to pick up the computer it gets viewed from.

Re: Cookies issue

Posted: Wed Jun 22, 2011 8:08 pm
by Jade
You need to read up on sessions. They can be set to use cookies.

Re: Cookies issue

Posted: Wed Jun 22, 2011 8:47 pm
by wasir
Thanks Jade. I will.