Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    CBG
    CBG is offline
    New Coder
    Join Date
    Feb 2010
    Location
    UK
    Posts
    91
    Thanks
    26
    Thanked 0 Times in 0 Posts

    Question Allow multiple IP's when in offline mode

    Hi,

    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?

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

    Code:
    $config['offline_ip']
    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
    Code:
    if ( $config['offline_ip'] OR $config['offline_ip2'] != getenv('REMOTE_ADDR')){
    Regards,
    CBG

  • #2
    Regular Coder
    Join Date
    Oct 2009
    Location
    United States
    Posts
    157
    Thanks
    8
    Thanked 4 Times in 4 Posts
    Hey there.

    If you are pulling it from the database, you could just do a query like so:
    PHP Code:
    $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.
    Last edited by votter; 02-12-2010 at 11:25 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •