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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2007
    Posts
    269
    Thanks
    28
    Thanked 0 Times in 0 Posts

    delete cookie using foreach

    i can delete all cookie using
    PHP Code:
    foreach($_COOKIE  as $c => $d){
                    
    setcookie($c,"",time()-3600);

        } 
    but i can not delete following cookie i created previously.

    (second one is automatically created )


    Code:
    127_0_0_1 : 1250981744
    PHPSESSID : 4eabf513497f6762077d2150b1ae7bf5

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,468
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    Are you confusing cookies with PHP sessions?
    Sessions are automatically deleted when the user closes their browser (session).

  • #3
    Regular Coder funnymoney's Avatar
    Join Date
    Aug 2007
    Posts
    364
    Thanks
    17
    Thanked 24 Times in 24 Posts
    to delete sessions you need to add this line of code

    PHP Code:
    <?php

    unset($_SESSION);
    session_destroy();

    ?>


  •  

    Posting Permissions

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