PHP samples howto assemble web related log items /*********************************************/ /* USER log items */ /*********************************************/ // get IP-adress $user1 = $_SERVER['REMOTE_ADDR']; // get Internet host name corresponding to a given IP address $user2 = gethostbyaddr($_SERVER['REMOTE_ADDR']); // alt. if server configuration allows $user2 = $_SERVER['REMOTE_HOST']; /*********************************************/ /* ORGANISATION log items */ /*********************************************/ // geolocate ip-adresses, using hostip.info, experimental // please visit http://www.hostip.info/use.html /* http://api.hostip.info/get_html.php?ip=12.215.42.19 Country: UNITED STATES (US) City: Sugar Grove, IL */ $url = 'http://api.hostip.info/get_html.php?ip='; $lines = file( $url.$_SERVER['REMOTE_ADDR'] ); $country = split( ':', $lines[0], 2 ); $organisation = trim( $country[1] ); $city = split( ':', $lines[1], 2 ); $organisation_spec = trim( $city[1] ); /*********************************************/ /* CLIENT log items */ /*********************************************/ // get user web client $client = $_SERVER[''HTTP_USER_AGENT']; // alt. PHP command 'get_browser', look it up! $clientinfo = get_browser( null, TRUE ); $client = $clientinfo['browser'].' '.$clientinfo['version']; $client_spec = $clientinfo['platform'];