We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

luman on 09/14/06


Tagged

ip


Versions (?)


Who likes this?

7 people have marked this snippet as a favorite

jonhenshaw
yuconner
blakeb
dmarten
vali29
willcodeforfood
jprice


Detect IP


Published in: PHP 


URL: http://www.php.net/getenv

  1. if (getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
  2. else $ip = getenv("REMOTE_ADDR");

Report this snippet 

You need to login to post a comment.