Physical location of cookies created by setCookie() function, and expiry

Discussion in 'PHP' started by knkk, Aug 25, 2007.

  1. #1
    I am not able to locate the cookies created by the setCookie function. They are not in the standard IE folder where temporary Internet files and cookies are placed. Does anyone know where I search, or how I trace them?

    Also, I created cookies using this command:

    
    $string_to_check = $type."_".$pid;
    setCookie("$string_to_check", "1", time()+30*1);
    
    Code (markup):
    The cookie doesn't expire in 30 seconds - in fact, it doesn't seem to expire at all.

    One of the reasons that I want to see the actual cookies is to see what the expiration time is being set to.

    I'd be quite grateful for any pointers. Thank you very much for your time!
     
    knkk, Aug 25, 2007 IP
  2. DeViAnThans3

    DeViAnThans3 Peon

    Messages:
    785
    Likes Received:
    83
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Weird problem. It should expire in 30 seconds :?
    The cookie is actually placed, or not (test with $HTTP_COOKIE_VARS)? As you pointed out it wasn't saved in the IE cookies directory for some reason.

    Why actually do you make your cookie name based on a variable, if it expires that fast?

    So far I know of, php functions are not case sensitive, but if it seems there was actually not placed ANY cookie, try setcookie in case of setCookie. Probably that won't make a difference, thoug :)
     
    DeViAnThans3, Aug 25, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    Maybe because your server's time is different to your local computer's time.
     
    nico_swd, Aug 25, 2007 IP
  4. knkk

    knkk Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for that. I just noticed that my code works in FF but not in IE. That is, the cookie expires in FF in 30s, but not in IE - and no, the server time is okay (my IE cookie never expires!). But I do not see the actual cookie in FF either (when I do Tools -> Options -> Show Cookies).
     
    knkk, Aug 26, 2007 IP
  5. knkk

    knkk Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Well, I am able to see the actual cookie in FF and in IE now (though I did nothing different :) ). I guess it was always visible in FF - it was just expiring in 30s, before I could see it. In IE, however, it is showing up suddenly now, and this is the text of the cookie file:

    events_3525
    1
    www.mydomain.com/
    1536
    3949138304
    29878276
    3661621984
    29878196
    *

    Would anyone know what all those numbers mean? Thank you for your time.
     
    knkk, Aug 26, 2007 IP
  6. knkk

    knkk Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I just figured that my IE cookie expires in about 9 hours and 33 minutes though I set it to expire in 30 seconds. Cannot figure out why :(.
     
    knkk, Aug 26, 2007 IP
  7. knkk

    knkk Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Okay, so I figured this out. The time zones in the client machine and the server were different (nico_swd, you were right!). I set them both to the exact same time and zone, and IE too started working.

    For anyone who needs to do the same on a Linux box (change the time zone):

    http://www.linuxsa.org.au/tips/time.html
     
    knkk, Aug 26, 2007 IP