Internal IP Address Needed for Custom Server Application - PHP SERVER Variables
===

I have read this:

http://stackoverflow.com/questions/4447716/how-to-get-the-my-systems-ip-address

But it's not really getting at the root problem for me.  I need to get the client IP on an internal network, eg, something `192.168.1.7` so that I know if the server is being accessed from an internal location or not.

I'm updating some code that was built some time ago by someone else, and this code snippet is in there:

    $octet = explode(".", getenv("REMOTE_ADDR"), 4);

    if($octet[0] != 192 && $octet[1] != 168 && $octet[2] != 1) { 
        die("You are unable to view this page from your current location."); 
    }

This looks like it's testing for that internal IP, but on another page with similar code, I get the `die` message.  That code actually shows my IP to be something other than `192.168.1.7`(this code's actually showing my static IP given to me by the ISP):

    if($octet[0] != 192 && $octet[1] != 168 && $octet[2] != 1) { 
        die("You are unable to view this page from your current location: " . getenv("REMOTE_ADDR")); 
    }

I'm a bit confused because this code seemed to have worked in the past but it isn't now.  I'm not totally sure when it stopped working but based on the code I'm seeing, it shouldn't have worked in the first place.