Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hidonet/4c293742c5984f82ec2e to your computer and use it in GitHub Desktop.
Save hidonet/4c293742c5984f82ec2e to your computer and use it in GitHub Desktop.
## Paste this code to /magmi_path/web/head.php file before first line of code...
### Magento admin yetkilendirmesi #####################################################
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