Last active
August 29, 2015 14:21
-
-
Save hidonet/4c293742c5984f82ec2e 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
## 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