#1
  1. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)
    hai
    i had set three cookies using cookie headers like this before Content-type:

    print "Set-Cookie: name=value1; expires='+1h';1215 ";
    ....
    print "Content-Type: text/html";

    Now i want to delete this cookie as my logout process.How can i delete the cookie;
    I know this can be done by using an expired date . How can i do this as of my prevoios example?

    vijay
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Location
    London, England
    Posts
    251
    Rep Power
    15
    LOL

    I asked this question quite recently and had it answered. So now it's my turn.....

    A cookie can be deleted by setting an expiry date in the past. You can either do this by setting an absolute date such as 1 Jan 1998 - or by using a relative value such as 2 days ago.

    The Netscape documentation says:

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>If a CGI script wishes to delete a cookie, it can do so by returning a cookie with the same name, and an expires time which is in the past. The path and name must match exactly in order for the expiring cookie to replace the valid cookie. This requirement makes it difficult for anyone but the originator of a cookie to delete a cookie.[/quote]

    http://www.netscape.com/newsref/std/cookie_spec.html


  4. #3
  5. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)
    hai,
    thanks.
    but you are speaking theoretically .
    how can i set a date ....
    how can i find and set date

    vijay
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    15
    Well, just use some real date in the past, say January 2nd, 1990. It will do the same thing. So, use your previous header:

    print "Set-Cookie: name=value1; expires='+1h';1215 ";

    and add this to it:

    print "Set-Cookie: name=value1; expires='02-Jan-1990';1215 ";

    According to the Netscape docs, this should work. This format is valid for setting an expiery date on a cookie.

    HTH.
  8. #5
  9. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)
    thanks again...

    i know how to set a cookie and deleting a cookie. But the problem is i want to know how can i set Date field.
    According to Netscape Specification we have to send a Date header , i think so.
    I want more details about this.
    Anybody please help me.

    vijay


IMN logo majestic logo threadwatch logo seochat tools logo