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'],
18 if ($sType == 'search')
20 $oDB->query('insert into query_log values ('.getDBQuoted($hLog[0]).','.getDBQuoted($hLog[3]).','.getDBQuoted($hLog[1]).')');
23 $sSQL = 'insert into new_query_log (type,starttime,query,ipaddress,useragent,language,format)';
24 $sSQL .= ' values ('.getDBQuoted($sType).','.getDBQuoted($hLog[0]).','.getDBQuoted($hLog[2]);
25 $sSQL .= ','.getDBQuoted($hLog[1]).','.getDBQuoted($_SERVER['HTTP_USER_AGENT']).','.getDBQuoted(join(',',$aLanguageList)).','.getDBQuoted($_GET['format']).')';
29 if (CONST_Log_File && CONST_Log_File_ReverseLog != '')
31 if ($sType == 'reverse')
33 $aStartTime = explode('.',$hLog[0]);
34 file_put_contents(CONST_Log_File_ReverseLog,
35 $aStartTime[0].','.$aStartTime[1].','.
37 '"'.addslashes(isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'').'",'.
38 '"'.addslashes($hLog[1]).'",'.
42 '"'.addslashes($_SERVER['HTTP_USER_AGENT']).'",'.
43 '"'.addslashes($_GET['format']).'"'."\n",
51 function logEnd(&$oDB, $hLog, $iNumResults)
53 $aEndTime = explode('.',microtime(true));
54 if (!$aEndTime[1]) $aEndTime[1] = '0';
55 $sEndTime = date('Y-m-d H:i:s',$aEndTime[0]).'.'.$aEndTime[1];
59 $sSQL = 'update query_log set endtime = '.getDBQuoted($sEndTime).', results = '.$iNumResults;
60 $sSQL .= ' where starttime = '.getDBQuoted($hLog[0]);
61 $sSQL .= ' and ipaddress = '.getDBQuoted($hLog[1]);
62 $sSQL .= ' and query = '.getDBQuoted($hLog[3]);
65 $sSQL = 'update new_query_log set endtime = '.getDBQuoted($sEndTime).', results = '.$iNumResults;
66 $sSQL .= ' where starttime = '.getDBQuoted($hLog[0]);
67 $sSQL .= ' and ipaddress = '.getDBQuoted($hLog[1]);
68 $sSQL .= ' and query = '.getDBQuoted($hLog[2]);
72 if (CONST_Log_File && CONST_Log_File_SearchLog != '')
74 $aStartTime = explode('.',$hLog[0]);
75 file_put_contents(CONST_Log_File_SearchLog,
76 $aStartTime[0].','.$aStartTime[1].','.
78 '"'.addslashes(isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'').'",'.
79 '"'.addslashes($hLog[1]).'",'.
80 '"'.addslashes($hLog[3]).'",'.
81 '"'.addslashes($_SERVER['HTTP_USER_AGENT']).'",'.
82 '"'.addslashes($_GET['format']).'",'.