title: Will the value of a set $_SERVER['HTTP_CLIENT_IP'] be an empty string?
body: <p>I have a simple script which determines the user's IP address:</p>
  
  <pre><code>function GetIp(){
        if (!empty($_SERVER['HTTP_CLIENT_IP']))
        //check ip from share internet
        {
          $ip=$_SERVER['HTTP_CLIENT_IP'];
        }
        elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
        //to check ip is pass from proxy
        {
          $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        else
        {
          $ip=$_SERVER['REMOTE_ADDR'];
        }
        return $ip;
  }
  </code></pre>
  
  <p>Now on the Net somewhere I saw someone using this script:</p>
  
  <pre><code>if (isset($_SERVER['HTTP_CLIENT_IP']) &amp;&amp; $_SERVER['HTTP_CLIENT_IP'] != '')
          $Ip = $_SERVER['HTTP_CLIENT_IP'];
      elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) &amp;&amp; $_SERVER['HTTP_X_FORWARDED_FOR'] != '')
          $Ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
      elseif (isset($_SERVER['REMOTE_ADDR']) &amp;&amp; $_SERVER['REMOTE_ADDR'] != '')
          $Ip = $_SERVER['REMOTE_ADDR'];
  </code></pre>
  
  <p>I was wondering if my implementation is broken.. Do I need to check if the value of <code>$_SERVER['HTTP_CLIENT_IP']</code>, <code>$_SERVER['HTTP_X_FORWARDED_FOR']</code>, or <code>$_SERVER['REMOTE_ADDR']</code> is empty? Or is it actually unnecessary to do so?</p>