Friday, November 18, 2016

Get magento session variable in php page

Mage::app('admin'); //get the admin session
Mage::getSingleton('core/session', array('name'=>'adminhtml')); //verify if the user is logged in to the backend
if(Mage::getSingleton('admin/session')->isLoggedIn()){
echo "logged in";
}else{
$url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
header('Location: '.$url."index.php/admin");
exit;
}

No comments:

Post a Comment