Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to check if admin is logged in or not from outside magento installation? 
 
spider2012
Jr. Member
 
Total Posts:  7
Joined:  2012-03-06
 

Hi,

I want to check if admin is logged in or not from outside magento. I’m using following code:

require_once 'app/Mage.php';
umask(0);
Mage::app('admin');

Mage::getSingleton('core/session', array('name'=>'adminhtml') ); 
$adminsession Mage::getSingleton('admin/session');

$isAdminLogin 0;
if(
Mage::getSingleton('admin/session')->isLoggedIn()) {
    $isAdminLogin 
1;
}

echo $isAdminLogin;

Above code works well first time. But when I logout admin and again login, the code still returns $isAdminLogin = 0.

Any help will be appreciable.

Thanks in advance.

Best Regards,
Deeps

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top