Better Client/Remote IP function.


/ Published in: PHP
Save to your folder(s)

Better Client/Remote IP function


Copy this code and paste it in your HTML
  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. }

URL: http://www.ypy.ir

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.