note 79230 deleted from reserved.variables by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: new to PHP, old hand at C 

----

Here is an ever-so-slightly more efficient version of Dlyaza's code snippet to get an IP address.  I think this ought to work, and if so, it should produce the same results as her original snippet below.

<?php
    if ($IP = getenv('HTTP_CLIENT_IP')) {}
      elseif ($IP = getenv('HTTP_X_FORWARDED_FOR')) {}
      elseif ($IP = getenv('HTTP_X_FORWARDED')) {}
      elseif ($IP = getenv('HTTP_FORWARDED_FOR')) {}
      elseif ($IP = getenv('HTTP_FORWARDED')) {}
      else {
        $IP = $_SERVER['REMOTE_ADDR'];
    }
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.