Cookies issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wasir
Forum Commoner
Posts: 49
Joined: Sun Jul 08, 2007 11:28 pm

Cookies issue

Post 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?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Cookies issue

Post by Benjamin »

:arrow: Moved to PHP - Code
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Cookies issue

Post by Jade »

Have you checked the browser settings on those computers? Sounds like a browser issue to me -- perhaps try clearing their caches.
wasir
Forum Commoner
Posts: 49
Joined: Sun Jul 08, 2007 11:28 pm

Re: Cookies issue

Post by wasir »

Tried all that. no luck.
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Cookies issue

Post 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
wasir
Forum Commoner
Posts: 49
Joined: Sun Jul 08, 2007 11:28 pm

Re: Cookies issue

Post by wasir »

can't avoid cookie because the website needs to pick up the computer it gets viewed from.
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Cookies issue

Post by Jade »

You need to read up on sessions. They can be set to use cookies.
wasir
Forum Commoner
Posts: 49
Joined: Sun Jul 08, 2007 11:28 pm

Re: Cookies issue

Post by wasir »

Thanks Jade. I will.
Post Reply