Created
November 18, 2015 16:44
-
-
Save fballiano/a2dabf4fecbe7cab8274 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('MAGENTO', realpath(dirname(__FILE__))); | |
require_once MAGENTO . '/app/Mage.php'; | |
Mage::app(); | |
umask(0); | |
Mage::app('default'); | |
Mage::getSingleton('core/session', array('name' => 'adminhtml')); | |
$user = Mage::getModel('admin/user')->loadByUsername('admin'); // Here admin is the Username | |
if (Mage::getSingleton('adminhtml/url')->useSecretKey()) Mage::getSingleton('adminhtml/url')->renewSecretUrls(); | |
$session = Mage::getSingleton('admin/session'); | |
$session->setIsFirstVisit(true); | |
$session->setUser($user); | |
$session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl()); | |
Mage::dispatchEvent('admin_session_user_login_success',array('user'=>$user)); | |
if ($session->isLoggedIn()) { | |
$redirectUrl = Mage::getSingleton('adminhtml/url')->getUrl(Mage::getModel('admin/user')->getStartupPageUrl(), array('_current' => false)); | |
header('Location: ' . $redirectUrl); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment