#1
  1. No Profile Picture
    markdrayton
    Guest
    Devshed Newbie (0 - 499 posts)
    Hi

    I have made some php scripts to log a user into a site and then store the user's nick in a cookie, using this code:

    setcookie("cookie",$nick,time()+3600,"/");

    (after checking a database, etc)

    The problem comes when I try to delete it when the user logs out. I am trying to use this code to do it:

    setcookie("cookie");

    which doesn't work.

    The logging in scipts are stored in /admin, and there are other scripts which depend on the cookie in directories next to /admin (ie /forum, /somethingelse). This initally gave me trouble in that I could log in, but not use the cookie in the other scripts. I fixed this by using the "/" when setting the cookie. I suspect the deletion is a similar problem, but adding "/" still doesn't work.

    Any ideas?
  2. #2
  3. No Profile Picture
    SJONdaMON
    Guest
    Devshed Newbie (0 - 499 posts)
    $nick = "";
    setCookie("cookie",$nick,time(),"/");

    That should do it...

    ------------------
    Have Fun !

    SJONdaMON
    http://www.sjondamon.org/

Similar Threads

  1. Having trouble with CGI cookies
    By deadbabypizza in forum Perl Programming
    Replies: 5
    Last Post: February 4th, 2004, 12:02 PM
  2. trouble deleting data from database
    By skootz in forum PHP Development
    Replies: 3
    Last Post: January 13th, 2004, 06:15 AM
  3. cant delete cookies random errors
    By toxical in forum PHP Development
    Replies: 2
    Last Post: November 26th, 2003, 06:16 AM
  4. Trouble getting cookies
    By StevenC in forum Java Help
    Replies: 3
    Last Post: July 1st, 2003, 04:28 PM
  5. Deleting cookies and data
    By chrima in forum PHP Development
    Replies: 3
    Last Post: May 22nd, 2003, 12:40 PM

IMN logo majestic logo threadwatch logo seochat tools logo