2009/06/18

Displaying visitor's IP address

This is a single line script to display the visiting IP address to a web site:
< ?php
echo $_SERVER['REMOTE_ADDR'];
?>

It works for both IPv4 and IPv6 addresses.

[Note: the extra space been left arrow and ? should be removed. I purposely made a space for deceiving html.]

No comments: