//print("$pageName <br> $pageUrl <br> $pageCategory ");exit; $a_idPages = recordDbPage($pageName, $pageUrlParamsProcessed, $pageCategory, false); $idPage = $a_idPages[0]; // save current page & url & variables information $idLink_vp = recordDbInfoPage($idVisit, $idPage, $idPageRef, $timeDiffRef, $a_vars); $total_time = DEFAULT_TIME_PAGE + todayTime() - $serverTime; // update last_visit_time & total_pages & c_total_time $r = query("UPDATE " . T_VISIT . "\n\t\t\tSET last_visit_time = CURRENT_TIME(),\n\t\t\t\ttotal_pages = total_pages + 1,\n\t\t\t\ttotal_time = '{$total_time}',\n\t\t\t\texit_idpage = '{$idPage}'\n\t\t\tWHERE idvisit = '{$idVisit}'\n\t\t\tLIMIT 1"); } else { printDebug("==> This is a new visit, we create datas in the database when necessary<br>"); if (!isset($ip) || !isset($ip2long)) { $ip = getIp(); $ip2long = ip2long($ip); exitIfIpExcluded($ip2long, $logo, $site); } $hostExt = getHostnameExt(getHost($ip)); printDebug('<br>ip : ' . $ip); printDebug('<br>hostname : ' . $hostExt); $serverDate = date("Y-m-d"); $serverTime = date("H:i:s"); $country = getCountry($hostExt, $browserLang); if ($country == 'gb') { $country = 'uk'; } $continent = getContinent($country); if (strlen($refererUrl) === 0) { $refererUrl = 'NULL'; } else { $refererUrl = "'" . $refererUrl . "'"; } // do it first because we need idpage for visit info insert
/** * useless from now on? 2.2RC1 */ function getNearestLang() { $country = getCountry(getHostnameExt(getHost(getIp())), secureVar(@$_SERVER['HTTP_ACCEPT_LANGUAGE'])); foreach ($this->langAvailable as $key => $langInfo) { if ($langInfo[3] == $country) { return $key; } } return $this->langAvailable['default_lang']; }