Jump to content

Multiple Maintenance IP's


Recommended Posts

Bump

I am building my site, and need to keep it closed, but really need to be able to allow multiple people to view it at the same time.... At this point for testing, this is REALLY important to me.

I know this can be done somehow... Anyone have any ideas?

Link to comment
Share on other sites

  • 1 month later...

Ok, I cant't give you a (tested) working code but after I looked in the sources I think you can try to modify the header.php in the root directory.

/* Display a maintenance page if shop is closed */
if (isset($maintenance) AND (!isset($_SERVER['REMOTE_ADDR']) OR $_SERVER['REMOTE_ADDR'] != Configuration::get('PS_MAINTENANCE_IP')))
{
   header('HTTP/1.1 503 temporarily overloaded');
   $smarty->display(_PS_THEME_DIR_.'maintenance.tpl');
   exit;
}

$smarty->display(_PS_THEME_DIR_.'header.tpl');



Not tested but should be something like this:

$ip1='102.134.234.123';
$ip2='123.123.123.123';
if (isset($maintenance) AND (!isset($_SERVER['REMOTE_ADDR']) OR $_SERVER['REMOTE_ADDR'] != $ip1 OR $_SERVER['REMOTE_ADDR'] != $ip2))
{
.....
.....
}





Greetz, trip

Link to comment
Share on other sites

I just tested it with my own IP (couldn't test the second IP as I only have on computer at hand a.t.m.) and this works:

in header.php change line 26 to

if (isset($maintenance) AND (!isset($_SERVER['REMOTE_ADDR']) OR !in_array($_SERVER['REMOTE_ADDR'], explode(" ", Configuration::get('PS_MAINTENANCE_IP')))))



Now you can set multiple IPs in the backend - SPACE SEPARATED!!

Maintanance IP: 192.168.10.1 192.168.10.2


etc.

if you want to use anything else instead of spaces to seperate the IPs, you need to change the line in header.php

explode("anything you want", ...

Link to comment
Share on other sites

×
×
  • Create New...