PHP code to show visitor’s informations
- Thursday, July 22, 2010, 5:19
- PHP
- Add a comment
|
|
Here’s some simple info displaying your IP address, browser info, and
the address that referred you to the page:
{code codetype=php}<?php
$your_ip = $_SERVER['REMOTE_ADDR'];
$your_hostaddress = gethostbyaddr($your_ip);
$your_browser = $_SERVER['HTTP_USER_AGENT'];
$referred = $_SERVER['HTTP_REFERER'];
print “<strong>IP address:</strong><br />\n”;
print “$your_ip<br /><br />\n”;
print “<strong>Host address:</strong><br />\n”;
print “$your_hostaddress<br /><br />\n”;
print “<strong>Your browser info</strong>:<br />\n”;
print “$your_browser<br /><br />\n”;
print “<strong> Where you came from :</strong>:<br />\n”;
if($referred)
{
print “$referred”;
}
else
{
print “refresh your browser”;
}
?>{/code}


