Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    anu
    anu is offline
    New Coder
    Join Date
    Jan 2006
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problem with deleting the clientside cookie

    Hi,
    Even after i am logging out my PHP web application still the cookie exist in the client browser. i am deleting the cooking using the following code

    setcookie(session_name(),'',time()-3600,'/')

    and i am using no cache control using the following code in all pages

    header('cache control: no-cache,max-age=0,must-revalidate');
    header('Pragma:no-cache');

    it is clearing all browser temporary files.but still the cookie is alive. how can i manage this problem.

  • #2
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Here's how I kill my cookies, and it works fine. Does this work for you? Looks like the only difference is the time subtraction.

    PHP Code:
    if (isset($_COOKIE[session_name()])) {
        
    setcookie(session_name(), ''time()-42000'/');

    And are you sure you're killing the cookie BEFORE you output any HTML or anything?
    Last edited by JohnDubya; 08-02-2008 at 08:17 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •