SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Cookie's Life

  1. #1
    SitePoint Enthusiast alsaffar's Avatar
    Join Date
    Aug 2002
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cookie's Life

    Hi there,

    I set a cookie and then I deleted that cookie manualy from the cookies folder in my windows.

    But although I deleted that cookie file from my windows, if I execute this code it'll give me the cookie contents:

    <?

    $CkUserName = $HTTP_COOKIE_VARS["CkUserName"];

    echo "The content of the cookie is: $CkUseName":

    ?>

    This is if I deleted the cookie file with colsing the session, it'll gave me the cookie content, even if I hit the Refresh button million times.

    And if I set the cookie with a php script to null, it will not see the cookie:

    <?
    setcookie ("CkUserName","","","/",".myDomain.com","");
    ?>

    This if I didn't close the session.

    But if I closed the session and run the first script again, it will not see the cookie!

    So is the cookie available for the session until its closed if deleted the cookis file manulay?

    Anything wrong with my knowledge? Anyone can help?
    HaVe a GooD DaY

    @li @l$@ff@R

  2. #2
    SitePoint Evangelist CyberFuture's Avatar
    Join Date
    May 2001
    Location
    San Diego, CA
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cookies are good for the browser's session, unless its time span is set. A cookie set to expire in 20 minutes will expire in 20 minutes. This is why the easist way to kill a cookie is to set its expire date to a date that has already pasted. This will caused the cookie to disappear.


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
  •