SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    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:

    Code:
    $string_to_check = $type."_".$pid;
    setCookie("$string_to_check", "1", time()+30*1);
    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!

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    C:\Documents and Settings\[Windows Username]\Cookies
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    California
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I recommend you just use Firefox and then you can go to firefox preferences -> privacy -> Show Cookies. And it will show you all the cookies you have (organized by domain), and then you can view the expiration dates there.

    I'm not sure if IE has this functionality built in, I haven't use IE in years
    Happy switcher to OS X running on a MacBook Pro.

    Zend Certified Engineer

  4. #4
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, 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. But, xmitchx, I do not see the actual cookie in FF either (when I do Tools -> Options -> Show Cookies). And logic_earth, I use Windows ME. I went to Tools - > Internet Options -> Settings -> View Files to view the cookies - it isn't there.

  5. #5
    SitePoint Zealot
    Join Date
    Jun 2007
    Location
    Regina, SK, Canada
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To force a cookie to expire you can set the expiry to a negative, like:
    setCookie("$string_to_check", "1", time()-30*1);

  6. #6
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

    Also, jboesch, I want the cookie to expire at a specific time after it is created. Any idea on on how I can do that with what you suggested?

  7. #7
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 .

  8. #8
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, so I figured this out. The time zones in the client machine and the server were different. 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


Bookmarks

Posting Permissions

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