cannot expire cookie

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

    cannot expire cookie

    Hi,
    I am having problems expiring cookies in PHP, i.e. when you want to
    logout of an application.

    Has anyone had this problem, and what is the solution. Working code is
    appreciated.

    --
    http://www.dbForumz.com/ This article was posted by author's request
    Articles individually checked for conformance to usenet standards
    Topic URL: http://www.dbForumz.com/PHP-expire-c...ict168002.html
    Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=562929
  • Daniel Tryba

    #2
    Re: cannot expire cookie

    steve <UseLinkToEmail @dbforumz.com> wrote:[color=blue]
    > I am having problems expiring cookies in PHP, i.e. when you want to
    > logout of an application.
    >
    > Has anyone had this problem, and what is the solution. Working code is
    > appreciated.[/color]

    Show us your code, maybe we can pinpoint the problem.

    FUP: comp.lang.php

    --

    Daniel Tryba

    Comment

    • steve

      #3
      Re: Re: cannot expire cookie

      "user782" wrote:[color=blue]
      > steve <UseLinkToEmail @dbforumz.com> wrote:[color=green]
      > > I am having problems expiring cookies in PHP, i.e. when you[/color]
      > want to[color=green]
      > > logout of an application.
      > >
      > > Has anyone had this problem, and what is the solution.[/color]
      > Working code is[color=green]
      > > appreciated.[/color]
      >
      > Show us your code, maybe we can pinpoint the problem.
      >
      > FUP: comp.lang.php
      >
      > --
      >
      > Daniel Tryba[/color]

      sorry I should have provided code:

      setcookie("user ", "", mktime(12,0,0,1 , 1, 1990), "/");

      --
      http://www.dbForumz.com/ This article was posted by author's request
      Articles individually checked for conformance to usenet standards
      Topic URL: http://www.dbForumz.com/PHP-expire-c...ict168002.html
      Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=562956

      Comment

      • John Postlethwait

        #4
        Re: cannot expire cookie

        Just set a new cookie with the same name when they "log out" and set an
        expired time on the cookie. Either that or set no time on it and have
        it expire when they close the window or leave the page.

        Comment

        • Hilarion

          #5
          Re: Re: cannot expire cookie

          > setcookie("user ", "", mktime(12,0,0,1 , 1, 1990), "/");

          The code above should clear the "user" cookie, but only
          if it was set with path parameter "/" and with time
          set (AFAIK session cookies - set with zero time - cannot
          be forced to expire, but can be cleared; you have to
          provide zero as time in clearing command).

          Remember that setting cookies (or clearing them) does not
          mean that you'll see the changes in the script in which
          you changed the cookie (you need reload or something).

          Hilarion


          Comment

          Working...