If you have been searching tirelessly for a solution to your Magento logout woes, have no worries your search is at an end! We’ve already searched and found. We’ve included the code you will need to add a Logout link to Magento. This code actually only displays the pertinent link – so if a user is already logged in they will only see a Logout link and if a user is not Logged in then they will see a Login link.
Here is the code:
<?php if (!Mage::getSingleton('customer/session')->isLoggedIn()): ?> <a href="<?php echo Mage::helper('customer')->getLoginUrl(); ?>"><?php echo $this->__('Login') ?></a> <?php else: ?> <a href="<?php echo Mage::helper('customer')->getLogoutUrl(); ?>"><?php echo $this->__('Logout') ?></a> <?php endif; ?>
Hope it Helps... Thanks