Nel tutorial di oggi vedremo come recuperare alcune informazioni relative al client che visita il vostro sito.
Viasualizzeremo in particolare, l’indirizzo IP, l’host, il browser e il link di provenienza del vostro visitatore.
< ?php
$ip = $_SERVER[‘REMOTE_ADDR’];
$hostaddress = gethostbyaddr($ip);
$browser = $_SERVER[‘HTTP_USER_AGENT’];
$referred = $_SERVER[‘HTTP_REFERER’]; // a quirky spelling mistake that stuck in php
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";
}
?>
fonte: www.sastgroup.com






