Run Magento Session Into An External Site

Sometimes if we are working with the Ecommerce platform then client wants to use the Magento as Backend and frontend in the Framework like the Codeignitor and the Zend. Suppose you want to use Magento backend in framework like as zend framework then the below code will enable you to use all Magento's power into your custom website

	require_once ( "/var/www/your-magento-directory/app/Mage.php" ); //Include Magento application

	Mage::app("default"); //Initialize Magento

	// You have two options here,

	Mage::getSingleton("core/session", array("name" => "frontend")); //"frontend" for frontend session

	Mage::getSingleton("core/session", array("name" => "adminhtml")); //"adminhtml" for admin session


You have done! Now you can use the internal classes and functions of Magento into your custom Framework website. i.e. If you want to check whether a customer is logged in or not by checking the Magento session.

	$session = Mage::getSingleton("customer/session");

	    echo "Logged in";
	    echo "Not logged in";

Now you can use all the functionality of the Magento in your Framework. Enjoy the Magento Coding.