clean up cookies

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • alain dhaene

    clean up cookies

    HI,

    Is there a function to clean cookies.

    e.g
    setcookie ("klant_cook",$ this->klant_exist,ti me()+3600);



    But during the session I want to clean this cookie.

    Is this possible with this statement:

    $_COOKIE['klant_cook'] = null;



    Thx,



    Alain


  • Garp

    #2
    Re: clean up cookies


    "alain dhaene" <a.dhaene@instr uct.be> wrote in message
    news:40756703$0 $1955$ba620e4c@ news.skynet.be. ..[color=blue]
    > HI,
    >
    > Is there a function to clean cookies.
    >
    > e.g
    > setcookie ("klant_cook",$ this->klant_exist,ti me()+3600);
    >
    >
    >
    > But during the session I want to clean this cookie.
    >
    > Is this possible with this statement:
    >
    > $_COOKIE['klant_cook'] = null;
    >[/color]

    Expire it:
    setcookie ("klant_cook",$ this->klant_exist,ti me()-1);

    It's all in the setcookie documentation:

    When deleting a cookie you should assure that the expiration date is in the
    past, to trigger the removal mechanism in your browser. Examples follow how
    to delete cookies sent in previous example:

    Example 2. setcookie() delete example

    <?php
    // set the expiration date to one hour ago
    setcookie ("TestCookie ", "", time() - 3600);
    setcookie ("TestCookie ", "", time() - 3600, "/~rasmus/", ".example.c om", 1);
    ?>

    HTH
    Garp


    Comment

    Working...