Created
September 22, 2015 10:46
-
-
Save St0iK/a34fb8f3feba934022f8 to your computer and use it in GitHub Desktop.
Securing Magmi UI access
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
function authenticate($username=”“,$password=”“){ | |
require "../../app/Mage.php"; | |
Mage::app('default'); | |
$user = Mage::getModel('admin/user'); | |
$user->login($username,$password); | |
$result = $user->getId(); | |
return $result ? true : false; | |
} | |
if (!isset($_SERVER[‘PHP_AUTH_USER’])) { | |
header('WWW-Authenticate:Basic realm="Magmi"'); | |
header('HTTP/1.0 401 Unauthorized'); | |
echo 'You must be logged in to use Magmi'; | |
die(); | |
} else { | |
if (!authenticate($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'])){ | |
header('WWW-Authenticate: Basic realm="Magmi"'); | |
header('HTTP/1.0 401 Unauthorized'); | |
echo 'You must be logged in to use Magmi'; | |
die(); | |
} | |
} | |
/***************** *********************/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doesn't work in Magento Community 1.9. I put the Magento admin username and password and continues to call me again and again. Should I replace something to make it work?
http://www.buenamarca.com/magmi/web/magmi.php
Thank you!