Results 1 to 4 of 4

Thread: avoiding cookies

  1. #1
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default avoiding cookies

    Hi,

    I have one php page in my site, and I don't want it to keep cookies,
    so on every new load of the page all the content will load over new.

    How can I do it?

    Thanks

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    It's not using cookies unless you've told it too. It's probably caching


    <HTML><HEAD>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="-1">
    </HEAD><BODY>
    </BODY>
    </HTML>
    http://support.microsoft.com/kb/234067

    or

    PHP Code:
    <?php
    header
    ("Cache-Control: no-cache");
    header("Pragma: no-cache");
    ?>
    <html>
    <head>
    </head>
    <body>
    </body>
    </html>
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default

    Hi, thanks, nice to learn something new
    Last edited by d-machine; 03-30-2010 at 03:21 PM.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    If you want to clear cookies, then you can do it like this:
    1. Loop through the array $_COOKIE
    2. For each entry, set it to '' (blank) and set the expiration date in the past-- in other words delete the cookie, but there is no direct way to delete (removing the value and setting the data in the past is the standard method).

    If you have already solved your initial problem, then this post is not needed, but it might be worthwhile in other cases.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •