View Full Version : Allow multiple IP's when in offline mode

02-12-2010, 11:14 PM

I have the below code, so I am able to put my IP in the admin and it will only display me the site, everyone else get the offline.php page.

Now if I wanted to allow multiple IP, what would I change the below code to?

if (strcmp($_SERVER['PHP_SELF'],"/offline.php") != 0)
if ( $config['offline_ip'] != getenv('REMOTE_ADDR')){
if ( $config['offline_status'] == 'offline' ) { header ('location: offline.php'); }

Currently pulls the IP address from the database

What I am after, is to have:
Multiple boxes in the admin when I can put an IP in each

So would I put the below or would it be something else, any help be great

if ( $config['offline_ip'] OR $config['offline_ip2'] != getenv('REMOTE_ADDR')){


02-12-2010, 11:22 PM
Hey there.

If you are pulling it from the database, you could just do a query like so:

$search = mysql_query("SELECT * FROM `tablename` WHERE `ip` = '.getenv('REMOTE_ADDR').'") or die(mysql_error());
$viewips = mysql_fetch_array($search);

if ($viewips == 1) {
//go to your page....
} else {
take them away

Think that is right. If that is what you are meaning. Seeing as you already have the $config one pulling it from the database, then all you would need would be the if statement.