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!
As you see, above is a simple piece of code to set cookie. And I'M SURE THAT IT DID WORK WELL, at least on my personal computer (both local and internet). But today when I surf my site (http://www.saigonartframe.com/products.php - you can check it) on 2 other PCs it doesn't work at all. When I check the Cookies folder (Documents and Settings), no cookie from saigonartframe exists (others, like devnetwork's do). I tried refreshing my browser thousands of times and checking if(setcookie("check","checkvalue")) => return TRUE. No sense.
Anyone can help me?
Last edited by Phoenixheart on Tue Aug 02, 2005 3:40 am, edited 1 time in total.
if there is data in the cookie array, then your settings are preventing the cookie to be dumped.
lastly, try reading the posts on the bottom of php.net's site. you'll usually find a post relating to the same issue you are having and solve it quite easily..
Yeah I know it will be quite simple changing to $_SESSION when developing. But you know this problem occurs after my web finished, and it's too complex to change now.
---
PLEASE NOTE AGAIN:
Cookies havenot been set, no relations with any varibles. As I said, a simple setcookie("cart","cart_values") doesn't work!
My opinion is, maybe there's a problem from server?
IE6 may need a 3rd Party Policy if the user has set the Security Level is set to "medium" (which is default). Hence, your cookies might work in Firefox and others, but not IE.
IE6 also retains short-term cookies (usually, but not always session-cookies) in memory rather than in the "temporary internet files" directory.
IE6 also likes to be particularly picky about expiry-times etc.
You may have an outdated version of PHP that doesn't support $_REQUEST, therefore, you might be able to get around this problem by using the old version "$HTTP_GET_VARS."
I checked this problem on some other computers in an Internet Service, and my cookies did work well ==> The problem comes from my company's local network.
But again, I don't know how to deal with a network!
Nope, not really, but I guess you can get around the retarded cookie problem by just doing the math before hand and just inputting it manually... I've had something <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> me off similar. (The fact that maybe 1 out of every 3 IE viewers simply can't view my website because it won't save my cookies...)
I found out the problem... Sorry, too busy to post it earlier.
That is, something wrong with your system or server's clock will cause setcookie() doesn't work with a short-range cookie. Maybe the cookie will be deleted right after created.
Now, if you set a cookie with time()+7*24*3600 (expires after one week), it will be OK. On the other hand, about one or two days life-time of the cookie may not function.
Hope this will help you!