/** * Init the phpmv cookie used in logging. Called when no previous phpmv cookie detected. * * @param string $uniqId Old uniqId if exists * * @return string uniqId assigned */ function put($uniqId = '') { printDebug("<br>=>Cookie is init on visitor (idcookie and last_visit_time)<br>"); if ($uniqId == '') { $uniqId = md5(uniqid(rand())); } $this->setVar('idcookie', $uniqId); $this->setVar('last_visit_time', todayTime()); return $uniqId; }
$refererUrl = "'" . $refererUrl . "'"; } // do it first because we need idpage for visit info insert $a_idPages = recordDbPage($pageName, $pageUrlParamsProcessed, $pageCategory, true); $idPageUrl = $a_idPages[1]; $idPage = $a_idPages[0]; $md5Config = md5($os . serialize($a_browser) . $resolution . $colorDepth . $pdf . $flash . $java . $javascript . $director . $quicktime . $realPlayer . $windowsMedia . $cookieAccept . $ip2long . $browserLang); // save visitor information $r = query("INSERT INTO " . T_VISIT . " \n\t\t\t\t\t\t(idsite, idcookie, returning, last_visit_time, server_date, server_time, md5config, \n\t\t\t\t\t\treferer, os, browser_name, browser_version, resolution, color_depth, \n\t\t\t\t\t\tpdf, flash, java, javascript, director, quicktime, realplayer, windowsmedia, cookie, \n\t\t\t\t\t\tlocal_time, ip, hostname_ext, browser_lang, country, continent, \n\t\t\t\t\t\ttotal_pages, total_time, entry_idpage, entry_idpageurl, exit_idpage)\n\t\t\t\t\tVALUES ('{$idSite}', '{$idCookie}', '{$returningVisitor}', CURRENT_TIME(), \n\t\t\t\t\t\t\t\t\t'{$serverDate}', '{$serverTime}', '{$md5Config}', \n\t\t\t\t\t{$refererUrl}, '{$os}', '" . $a_browser['shortName'] . "',\n\t\t\t\t\t'" . $a_browser['version'] . "', '{$resolution}', '{$colorDepth}', \n\t\t\t\t\t'{$pdf}', '{$flash}','{$java}', '{$javascript}', '{$director}', '{$quicktime}', '{$realPlayer}', '{$windowsMedia}', '{$cookieAccept}', \n\t\t\t\t\t'{$localTime}','{$ip2long}', '{$hostExt}', '{$browserLang}', '{$country}', '{$continent}', \n\t\t\t\t\t1, '" . DEFAULT_TIME_PAGE . "', '{$idPage}', '{$idPageUrl}', '{$idPage}')\n\t\t\t"); $idVisit = mysql_insert_id(); // save page view and URL and variables recordDbInfoPage($idVisit, $idPage, $idPageRef, $timeDiffRef, $a_vars); // save idvisit $GLOBALS['cookie']->setVar('idvisit', $idVisit); $GLOBALS['cookie']->setVar('last_visit_time', todayTime()); $GLOBALS['cookie']->setVar('server_time', todayTime()); $GLOBALS['cookie']->setVar('server_date', $serverDate); } $GLOBALS['cookie']->setVar('idpage_ref', $idPage); $GLOBALS['cookie']->save(); printDebug("<br><b>Next cookie should be :</b>"); printDebug($GLOBALS['cookie']->getContent()); // footer if (PRINT_QUERY_COUNT) { printQueryCount(); } if (PRINT_TIME) { printTime(); } if (SAVE_DB_LOG) { recordDbQueryCount($idSite);