title: Facebook Connect Log Out
body: <p>I am developing a Php based application with CodeIgniter using Facebook Connect SDK for php. So far all users are able to log in into the system but for some when they try to log out the session would not expire! This is really odd since this would work for some users and not work for the others! 
  Following is the basic logout code that I use that Facebook provided: 
  controller: </p>
  
  <pre><code>if ($user) {
              $data['logoutUrl'] = $this-&gt;facebook-&gt;getLogoutUrl();
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;a href="&lt;?php echo $logoutUrl; ?&gt;" id="bstyle" onclick="RemoveSess()"&gt;Logout&lt;/a&gt;
  </code></pre>
  
  <p>JavaScript: </p>
  
  <pre><code>function RemoveSess(){
                  $.post("&lt;?php echo base_url(); ?&gt;"+ "/facebook_cn/remSess", function(data){
                          document.getElementById('message').innerHTML = $data;       
                        });   
              }
  </code></pre>
  
  <p>Php Controller:</p>
  
  <pre><code>function remSess()
  {
      $data2 = array('user_id' =&gt; '','logged_in' =&gt; '');
      $this-&gt;session-&gt;unset_userdata($data2);
      $this-&gt;session-&gt;sess_destroy();
      session_destroy();
      $data = array('sess' =&gt; "gone" );
      echo json_encode($data["sess"]="gone");
  }
  </code></pre>