Posted By

FXDB on 01/14/11


Tagged


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

redhaze
qubestream
ericserrat
jbyerson
noone453


Get Users IP Address


 / Published in: PHP
 

  1. if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
  2. $ip=$_SERVER['HTTP_CLIENT_IP'];
  3. } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
  4. $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
  5. } else {
  6. $ip=$_SERVER['REMOTE_ADDR'];
  7. }

Report this snippet  

You need to login to post a comment.