Posted By

YPY on 10/12/10


Tagged

php remote ip client IPHTTPHTTPS


Versions (?)

Better Client/Remote IP function.


 / Published in: PHP
 

URL: http://www.ypy.ir

Better Client/Remote IP function

  1. function Client_IP()
  2. {
  3. #array('HTTP_CLIENT_IP', 'CLIENT_IP', 'REMOTE_ADDR', 'HTTP_PROXY_CONNECTION', 'HTTP_FORWARDED', 'HTTP_X_FORWARDED', 'FORWARDED_FOR_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED_FOR_IP', 'HTTP_X_FORWARDED_FOR', 'FORWARDED', 'X_FORWARDED_FOR', 'FORWARDED_FOR', 'X_FORWARDED', 'HTTP_VIA', 'VIA');
  4.  
  5. if(isset($_SERVER['REMOTE_ADDR'])): $_Str_Return= &$_SERVER['REMOTE_ADDR'];
  6. elseif(getenv('REMOTE_ADDR')): $_Str_Return= &getenv('REMOTE_ADDR');
  7. else: $_Str_Return= HTTP_SERVER_VARS['REMOTE_ADDR'];
  8. endif;
  9.  
  10. return($_Str_Return);
  11. }

Report this snippet  

You need to login to post a comment.