title: How to create a button to close active session in joomla 2.5
body: <p>I need to create a button to log out in Joomla, I mean, the user usually enter the session but then must press the button I created to close this session, I know how to check if any user has entered the session and I know how to display the button, what I don't know is how to make that button close the actual user session (log out).</p>
  
  <p>This is the base code I have:</p>
  
  <pre><code>&lt;?php $user =&amp; JFactory::getUser(); ?&gt;
  &lt;?php if ( ($user-&gt;id)==0 ) : ?&gt;
  
      //***code for not opened session***
  
  &lt;?php else : ?&gt;
  
      &lt;form id="form1" name="form1" method="post" action=""&gt;
        &lt;input type="button" name="button" id="button" value="Close Session" /&gt;
      &lt;/form&gt;
  
  &lt;?php endif ?&gt;
  </code></pre>
  
  <p>How to make that button to close the joomla 2.5 session, I checked the API page but i didn't find it.</p>