Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7059863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:16:59+00:00 2026-05-28T04:16:59+00:00

To check what cookies exist i use this file (test.php): foreach ($_COOKIE as $key

  • 0

To check what cookies exist i use this file (test.php):

foreach ($_COOKIE as $key => $value) {
    print $key . "=" . $value . "</br>";
}

I get the following output:

fbsr_{app id}={a bunch of chars}

(Where the stuff within {} are private data)

To remove all my sessions i use this:

session_start();
session_unset();
session_destroy();

And this to remove my cookies:

setcookie('fbsr_' . $app_id, $_COOKIE['fbsr_' . $app_id], time() - 3600);
setcookie('PHPSESSID', $_COOKIE['PHPSESSID'], time() - 3600);
unset($_COOKIE['fbsr_' . $app_id]);   
unset($_COOKIE['PHPSESSID']);

Problem is when i run the code to check if my cookies are dead, they are not, and i get the same output :/

Why are my cookies not removed? Is my code bad somewhere? tried several browsers…

EDIT:
Seems like the cookies gets destroyed after all, but the test function still prints the cookie output?!?! im confused?!

(logout file)

if($action == 'logout'){

        $app_id = $facebook->getAppID();

        if (isset($_COOKIE['fbsr_' . $app_id])) {
            echo 'goes here<br>';
            setcookie('fbsr_' . $app_id, $_COOKIE['fbsr_' . $app_id], time() - 3600, "/");
            setcookie('PHPSESSID', $_COOKIE['PHPSESSID'], time() - 3600, "/");
            unset($_COOKIE['fbsr_' . $app_id]);   
            unset($_COOKIE['PHPSESSID']);
        }

        if (isset($_COOKIE['fbsr_' . $app_id])) {
            echo 'is still sett<br>';
        }

        session_start();
        session_unset();
        session_destroy();

        $result = array("success" => "true");
    }

It never prints is still sett which means the cookie is deleted!

Thank you 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:17:00+00:00Added an answer on May 28, 2026 at 4:17 am

    This is a method I have used to remove cookies

    if (isset($_COOKIE['cookieName'])) {
         setcookie('cookieName', '', time()-1);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Check out this test: [TestFixture] public class Quick_test { [Test] public void Test() {
check this out: template <class T> class Test: public T { public: void TestFunc()
What's an elegant way in Classic ASP to check if session cookies are enabled
Does MVC.NET handle Roles using cookies, or does a controller check with the Role
check this example: > a = matrix(1:9, nrow = 3, ncol = 3, dimnames
When I use PHP header redirection, all session variables are lost... Some people say
During sign-in I'm using following function to set cookies and session protected function validateUser($userid,
I tried to use setcookie(user, , time()-3600) to delete a cookie from php, but
I set up a website to use SqlMembershipProvider as written on this page .
How can you keep track of login status by PHP? I include the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.