title: Facebook PHP SDK - will not logout properly
body: <p>I've been searching for hours for the solution to this problem but can't find one that works for me. When i click "Logout" on my site the user information is still visible and the logout button is still displayed. Here is the code:</p>
  
  <pre><code>require 'facebook-php-sdk/src/facebook.php';
  
  $facebook = new Facebook(array(
    'appId'  =&gt; 'xxxx',
    'secret' =&gt; 'xxxx',
  ));
  
  // Get User ID
  $user = $facebook-&gt;getUser();
  var_dump($user);
  if ($user) {
    try {
      // Proceed knowing you have a logged in user who's authenticated.
      $user_profile = $facebook-&gt;api('/me');
    } catch (FacebookApiException $e) {
      error_log($e);
      $user = null;
    }
  }
  
  // Login or logout url will be needed depending on current user state.
  
  if ($_GET['logout'] == "yes") {
  setcookie('fbs_'.$facebook-&gt;getAppId(), '', time()-100, '/', 'http://gno.....ment/index.php');
  session_destroy();
  header("Location: ".$_SERVER['PHP_SELF']."");
  }
  
  if ($user_profile) {
    $logoutUrl = $facebook-&gt;getLogoutUrl;
  } else {
    $loginUrl = $facebook-&gt;getLoginUrl(array('scope' =&gt; 'email,publish_stream,user_status',
    'canvas' =&gt; 1,
    'fbconnect' =&gt; 0,
    'redirect_uri' =&gt; 'http://gno.....ment/index.php'));
  }
  </code></pre>
  
  <p>.....
  .....</p>
  
  <pre><code>&lt;?php if ($user): ?&gt;
  &lt;h3&gt;You&lt;/h3&gt;
  &lt;img src="https://graph.facebook.com/&lt;?php echo $user; ?&gt;/picture"&gt;
  
  &lt;h3&gt;Your User Object (/me)&lt;/h3&gt;
  &lt;pre&gt;&lt;?php print_r($user_profile); ?&gt;&lt;/pre&gt;
  &lt;?php else: ?&gt;
  &lt;strong&gt;&lt;em&gt;You are not Connected.&lt;/em&gt;&lt;/strong&gt;
  &lt;?php endif ?&gt;
  
  &lt;?php if ($user): ?&gt;
  &lt;a href="&lt;?php echo $logoutUrl; ?&gt;"&gt;Logout of FB&lt;/a&gt;
  &lt;?php else: ?&gt;
  &lt;div&gt;
  Login using OAuth 2.0 handled by the PHP SDK:
  &lt;a href="&lt;?php echo $loginUrl; ?&gt;"&gt;Login with Facebook&lt;/a&gt;
  &lt;/div&gt;
  &lt;?php endif ?&gt;
  </code></pre>
  
  <p>It seems that <code>if ($_GET['logout'] == "yes")</code> might be the answer for me but i can't get it working. I don't know where <code>logout</code> is gotten from or where it is defined? </p>
  
  <p>This seems to be a common issue but i can't figure it out. I'd really appreciate some help.</p>