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

catchamonkey on 01/24/08


Tagged

php ip visitor


Versions (?)


Who likes this?

5 people have marked this snippet as a favorite

catchamonkey
mbcdg
Morgano
Nix
lfatr


retrieve and/or show a visitors ip address


Published in: PHP 


  1. // to retrieve a visitors ip address and assign it to a variable
  2.  
  3. $domain = GetHostByName($REMOTE_ADDR);
  4. // echo this onto the page if you want
  5.  
  6. // or you could chuck it on the page like this
  7. echo $_SERVER['REMOTE_ADDR'];

Report this snippet 

You need to login to post a comment.