Poor man's view of the world

This is a very simple php code for a displaying visitor IP, browser and OS information.

To see a working demo of this code, visit: http://www.rohasnagpal.com/projects/ip

code

<?
$ip = $_SERVER['REMOTE_ADDR'];
$hostaddress = gethostbyaddr($ip);
$browser = $_SERVER['HTTP_USER_AGENT'];
$referred = $_SERVER['HTTP_REFERER'];print "Display IP address:
\n";
print "$ip\n";
print "More detailed host address:
\n";
print "$hostaddress

\n";
print "Display browser info:
\n";
print "$browser

\n";
print "Where you came from (if you clicked on a link to get here:
\n";
if ($referred == "") {
print "Page was directly requested";
}
else {
print "$referred";
}
?>

 

Tags: