3 function logStart(&$oDB, $sType = '', $sQuery = '', $aLanguageList = array())
5 $aStartTime = explode('.',microtime(true));
6 if (!$aStartTime[1]) $aStartTime[1] = '0';
9 date('Y-m-d H:i:s',$aStartTime[0]).'.'.$aStartTime[1],
10 $_SERVER["REMOTE_ADDR"],
11 $_SERVER['QUERY_STRING'],
17 $sSQL = 'insert into new_query_log (type,starttime,query,ipaddress,useragent,language,format,searchterm)';
18 $sSQL .= ' values ('.getDBQuoted($sType).','.getDBQuoted($hLog[0]).','.getDBQuoted($hLog[2]);
19 $sSQL .= ','.getDBQuoted($hLog[1]).','.getDBQuoted($_SERVER['HTTP_USER_AGENT']).','.getDBQuoted(join(',',$aLanguageList)).','.getDBQuoted($_GET['format']).','.getDBQuoted($hLog[3]).')';
23 if (CONST_Log_File && CONST_Log_File_ReverseLog != '') {
24 if ($sType == 'reverse')
26 $aStartTime = explode('.',$hLog[0]);
27 file_put_contents(CONST_Log_File_ReverseLog,
28 $aStartTime[0].','.$aStartTime[1].','.
30 '"'.addslashes(isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'').'",'.
31 '"'.addslashes($hLog[1]).'",'.
35 '"'.addslashes($_SERVER['HTTP_USER_AGENT']).'",'.
36 '"'.addslashes($_GET['format']).'"'."\n",
44 function logEnd(&$oDB, $hLog, $iNumResults)
46 $aEndTime = explode('.',microtime(true));
47 if (!$aEndTime[1]) $aEndTime[1] = '0';
48 $sEndTime = date('Y-m-d H:i:s',$aEndTime[0]).'.'.$aEndTime[1];
52 $sSQL = 'update new_query_log set endtime = '.getDBQuoted($sEndTime).', results = '.$iNumResults;
53 $sSQL .= ' where starttime = '.getDBQuoted($hLog[0]);
54 $sSQL .= ' and ipaddress = '.getDBQuoted($hLog[1]);
55 $sSQL .= ' and query = '.getDBQuoted($hLog[2]);
59 if (CONST_Log_File && CONST_Log_File_SearchLog != '') {
60 $aStartTime = explode('.',$hLog[0]);
61 file_put_contents(CONST_Log_File_SearchLog,
62 $aStartTime[0].','.$aStartTime[1].','.
64 '"'.addslashes(isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'').'",'.
65 '"'.addslashes($hLog[1]).'",'.
66 '"'.addslashes($hLog[3]).'",'.
67 '"'.addslashes($_SERVER['HTTP_USER_AGENT']).'",'.
68 '"'.addslashes($_GET['format']).'",'.