Cookie and subfolder
I create a cookie with:
with some Php code installed into the root folder, specifying the "/" to make it reachable from anywhere in the website.
SetCookie("accesJeux[nombre]",$valeurCookie,(time() + $dureeCookie*60*60),"/");
I want to add up 1 to its count with:
with some other Php code installed into a subfolder.
$score = $_COOKIE['accesJeux']['nombre'] + 1;
My problem is that the cookie count is not incremented.
On the other side, when I put that last code into the root folder, le cookie is well incremented.
Thank you in adavnce for your help.
When you set the cookie the second time, shouldn't you also use the "/" designation? It may be setting it for the subfolder, which is why you don't see the increment. Just a thought, but I'd use the same fields as when you created the cookie, every time you reset it.
I ran the test you suggested with the incrementing setcookie() setup with the exact same number of parameters as the creating cookie.
It works, the cookie is indeed incremented, this is the solution I was looking for..
Thank you for your help.
Users Browsing this Thread
There are currently 1 users browsing this thread.
(0 members and 1 guests)