Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Admin Access in Maintenance mode. 
 
keshavtech
Jr. Member
 
Total Posts:  1
Joined:  2011-08-09
 

Hi ,

I am using magento community edition ver 1.7.0.0 .
I like to add a welcome page in my site until I developed the whole site.
I got plugin for maintenanace mode which helps me to put simple html code.
I wants to have a integrated form which gets saved in database.

I also tried with magento’s root maintenance.flag file. but if i add it I am also not able to access admin. I can give access with IP but i wants to have admin access from different places. Which i am not able to do.
I have tried to change code of index file to check the admin login. But it gives me error. Below is my code.

$mageFilename MAGENTO_ROOT '/app/Mage.php';
$maintenanceFile 'maintenance.flag';

if (!
file_exists($mageFilename)) {
    
if (is_dir('downloader')) {
        header
("Location: downloader");
    
else {
        
echo $mageFilename." was not found";
    
}
    
exit;
}
require_once $mageFilename;
//require 'app/Mage.php';
Mage::app('default');
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
//verify if the user is logged in to the backend

$path=$_SERVER['REQUEST_URI'];

if (
file_exists($maintenanceFile)){

    
if(!Mage::getSingleton('admin/session')->isLoggedIn()){
        
include_once $maintenanceFile;
         exit;

    
}
    
else if(!strpos($path'admin'))
    
{
         
include_once $maintenanceFile;
         exit;
    
}
}



#Varien_Profiler::enable();

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage
::setIsDeveloperMode(true);
}

#ini_set('display_errors', 1);

umask(0);

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE''';

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE''store';

Mage::run($mageRunCode$mageRunType);
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top