MCQs > IT & Programming > Magento > Which code samples will detect if the account being checked on the front-end is an admin account?

Magento MCQs

Which of the following code samples will detect if the account being checked on the front-end is an admin account?

Answer

Correct Answer: <?php require_once 'app/Mage.php'; ini_set('display_errors',true); Mage::setIsDeveloperMode(true); umask(0) ; Mage::app(); //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 "Admin Logged in with following details".'<br>'; echo "Admin Username: - ".Mage::getSingleton('admin/session')->getData('user')->getUsername().'<br>'; echo "Admin Encrypted Password: - ".Mage::getSingleton('admin/session')->getData('user')->getPassword().'<br>'; } else { echo "You need to be logged in as an admin."; } ?>

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Magento Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Magento Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it