Magento – How to check admin user is login or not by externally php script

adminhtmlmagento-1.9PHPprogrammatically

I am working on externally php + magento script.My requirement write a php code from which i get all online admin users.

Example:

Admin1 – Login – Action
Admin2 – Login – Action

And so on….

How can i achieve this by php script.I know to load magento app file in externally php file. Here action is logout script with the help of which i want logout admin user from this page.

Best Answer

Try this:

<?php
require_once('app/Mage.php');
Mage::app('admin');

class AR
{
    public function index()
    {
        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 user is login";
        }
        else{
          echo "Admin user is not login";
        }

    }

}

$obj = new AR();
$obj->index();
?>
Related Topic