19.9)) {exit;} $bt=sprintf('%01.3f', $bt); $date=date('Y-m-d H:i:s'); // or use gmdate instead of server time if ($location=='view-page') {$location=isset($_GET['view']) ? $_GET['view'] : get_path();} $page=bb_get_uri_page(); if (!empty($page) && (int) $page>1) {$page='-'.$page;} else {$page='';} $ip=$_SERVER['REMOTE_ADDR']; if ($browsertimer['geoip']=='ip2c') {require_once('ip2c.php'); $ip2c = new ip2country(rtrim(dirname(__FILE__),' /\\').'/ip-to-country.bin'); $cc=$ip2c->get_country($ip); $cc = $cc==false ? '??' : $cc['id2'];} elseif ($browsertimer['geoip']=='maxmind') {$cc=$bbdb->get_var("SELECT cc FROM maxmind WHERE start<= inet_aton('$ip') ORDER BY start DESC LIMIT 1");} $cc=empty($cc) ? '??' : strtoupper($cc); $agent=$_SERVER['HTTP_USER_AGENT']; // sanitize UA to only interesting stuff $agent=preg_replace('/(\bU\;|OfficeLive|iPhone\; CPU|macintosh\;|windows\;|qq.+ [0-9]+\;|compatible;|mozilla|gecko|OfficeLive.+\;|\.NET CLR |KHTML\, like )(\s|\S+)/sim','',$agent); $agent=str_replace(array('NT 4.10','NT 4.90','NT 5.0','NT 5.1','NT 5.2','NT 6.0','NT 6.1','NT 6.2'),array('98','ME','2000','XP','XP 64','Vista','7','8'),$agent); $agent=preg_replace('/(\))/','; ',$agent); $agent=preg_replace('/[^A-Za-z0-9\s\:\;\!\?\/\\\<\>\.\,\'\"\@\-]/','',$agent); $agent=preg_replace('/(\s+)/',' ',$agent); $agent=addslashes(substr(trim($agent),0,85)); $output="$date $ip $cc $bt $location$page $agent\n"; if (!empty($browsertimer['log']) && $fh = fopen($browsertimer['log'], 'ab')) {fwrite($fh, $output);fclose($fh);} exit; } function browsertimer_foot() { global $browsertimer, $bb_timestart; $location=bb_get_location(); if (!empty($browsertimer['pages']) && !in_array($location,$browsertimer['pages'])) {return;} $bt=dechex(round($bb_timestart-strtotime(gmdate('Y-m-d',time()).' 00:00:01 +0000'),4)*10000); $crc=substr('0000'.dechex(crc32($bt.$_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_USER_AGENT'])+0),-4); ?>