www.webdeveloper.com
Results 1 to 3 of 3

Thread: Cookie and subfolder

Hybrid View

  1. #1
    Join Date
    Jan 2012
    Posts
    6

    Cookie and subfolder

    hello

    I create a cookie with:
    Code:
    SetCookie("accesJeux[nombre]",$valeurCookie,(time() + $dureeCookie*60*60),"/");
    with some Php code installed into the root folder, specifying the "/" to make it reachable from anywhere in the website.

    I want to add up 1 to its count with:
    Code:
    $score = $_COOKIE['accesJeux']['nombre'] + 1;
    SetCookie("accesJeux[nombre]", $score);
    with some other Php code installed into a subfolder.

    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.

    Francois

  2. #2
    Join Date
    Jul 2003
    Location
    Lansdale, PA
    Posts
    88
    Francios,

    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.

    -Jim

  3. #3
    Join Date
    Jan 2012
    Posts
    6
    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.

    Francois

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles