function wizard10(){ $q=new mysql_squid_builder(); $page=CurrentPageName(); $tpl=new templates(); $sock=new sockets(); $t=$_GET["t"]; $tt=time()+rand(0,time()); if(!$q->BD_CONNECT()){ echo FATAL_WARNING_SHOW_128("<hr>{error}<hr>{statistics_database}<hr>$q->mysql_error".wizard_restart());return; } $q=new mysql_storelogs(); if(!$q->BD_CONNECT()){ echo FATAL_WARNING_SHOW_128("<hr>{error}<hr>{logs_database}<hr>$q->mysql_error".wizard_restart());return; } echo $tpl->_ENGINE_parse_body("<center style='font-size:18px'>{statistics_database}:OK</center> <center style='font-size:18px'>{logs_database}:OK</center>")." <div id='$tt'></div> <script> LoadAjax('$t','$page?wizard11=yes&t=$t'); </script> "; }
function search_database() { $page = 1; $MyPage = CurrentPageName(); $users = new usersMenus(); $tpl = new templates(); $sock = new sockets(); $q = new mysql_storelogs(); if (!$q->BD_CONNECT()) { senderror($q->mysql_error); } if ($q->start_error != null) { senderror($q->start_error); } $table = "files_info"; $tableOrg = $table; $database = $q->database; $t = time(); $delete_alert = $tpl->javascript_parse_text("{delete_this_item}"); $MySQLType = $tpl->_ENGINE_parse_body($q->MYSQLTypeText); //if(!$q->TABLE_EXISTS($table,$database)==0){senderror("{table_does_not_exists}: <strong>$database/$table</strong> $MySQLType: `$q->SocketName`!");} if ($q->COUNT_ROWS($table, $database) == 0) { senderror("{$table}/{$database} is empty"); } $searchstring = string_to_flexquery("search-database"); $limit = "LIMIT 0,250"; if (is_numeric($_GET["xtime"])) { $WHERE1 = " (DATE_FORMAT(filetime,'%Y-%m-%d')='" . date("Y-m-d") . "') AND"; unset($_SESSION["QUERY_SYSLOG_DATE"]); } if ($_SESSION["QUERY_SYSLOG_LIMIT"] > 0) { $limit = "LIMIT 0,{$_SESSION["QUERY_SYSLOG_LIMIT"]}"; } $filters = array(); $filters[] = SearchToSql("DATE_FORMAT(filetime,'%Y-%m-%d')", $_SESSION["QUERY_SYSLOG_DATE"]); $filters[] = SearchToSql("filename", $_SESSION["QUERY_SYSLOG_FILE"]); $filters[] = SearchToSql("hostname", $_SESSION["QUERY_SYSLOG_HOST"]); $table = "(SELECT `filename`,`taskid`,`storeid`,`filesize`,`filetime`,`hostname` FROM {$table}\n\t\t\tWHERE {$WHERE1} (`filename` LIKE 'auth.log%') OR (filename LIKE 'squid-access%')) as t"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} " . @implode(" ", $filters) . " ORDER BY `filetime` DESC LIMIT 0,250"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { senderror("{$q->mysql_error}"); } if (mysql_num_rows($results) == 0) { senderror("Query return empty array"); } $boot = new boostrap_form(); while ($ligne = mysql_fetch_assoc($results)) { $md5S = md5(serialize($ligne)); $filename = $ligne["filename"]; $hostname = $ligne["hostname"]; $storeid = $ligne["storeid"]; $taskid = $ligne["taskid"]; $filesize = FormatBytes($ligne["filesize"] / 1024); $filetime = $ligne["filetime"]; $delete = imgsimple("delete-32.png", null, "Delete{$t}('{$storeid}','{$md5S}')"); $action = " "; if (preg_match("#auth\\.log-.*?#", $ligne["filename"])) { $action = imgsimple("32-import.png", null, "Loadjs('squid.restoreSource.php?filename={$ligne["filename"]}&storeid={$storeid}')"); } if (preg_match("#squid-access-(.*?)\\.log\\.#", $ligne["filename"])) { $action = imgsimple("32-import.png", null, "Loadjs('squid.restoreSource.php?filename={$ligne["filename"]}&storeid={$storeid}')"); } $download = "<a href=\"{$MyPage}?download={$storeid}&filename={$ligne["filename"]}&storeid={$storeid}\"><img src='img/arrow-down-32.png'></a>"; $js = "Loadjs('logrotate.php?log-js=yes&filename={$filename}&storeid={$storeid}&t=1368560783');"; $trlink = $boot->trswitch($js); $tr[] = "\n\t\t<tr id='{$md5S}'>\n\t\t<td nowrap {$trlink}>{$filetime}</td>\n\t\t<td nowrap {$trlink}>{$filename}</td>\n\t\t<td nowrap {$trlink}>{$hostname}</td>\n\t\t<td nowrap {$trlink}>{$filesize}</td>\n\t\t<td width=1% align=center>{$download}</td>\n\t\t<td width=1% align=center>{$action}</td>\n\t\t<td width=1% align=center>{$delete}</td>\n\t\t</tr>\n\t\t"; } echo $tpl->_ENGINE_parse_body("\n\n\t\t\t<table class='table table-bordered table-hover'>\n\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{date}</th>\n\t\t\t\t\t<th>{filename}</th>\n\t\t\t\t\t<th>{hostname}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>\n\t\t\t<script>\n\t\t\tvar memedb{$t}='';\n\t\t\tvar xDelete{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>2){alert(results);return;}\n\t\t\t\$('#'+memedb{$t}).remove();\n}\n\n\t\t\tfunction Delete{$t}(ID,md){\n\t\t\tmemedb{$t}=md;\n\t\t\tif(confirm('{$delete_alert} '+ID+' ?')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('syslog-delete',ID);\n\t\t\tXHR.sendAndLoad('{$MyPage}', 'POST', xDelete{$t});\n}\n}\n\t\t\t</script>"; }
function wizard10() { $q = new mysql_squid_builder(); $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $t = $_GET["t"]; $tt = time() + rand(0, time()); if (!$q->BD_CONNECT()) { echo FATAL_ERROR_SHOW_128("<hr>{error}<hr>{statistics_database}<hr>{$q->mysql_error}" . wizard_restart()); return; } $q = new mysql_storelogs(); if (!$q->BD_CONNECT()) { echo FATAL_ERROR_SHOW_128("<hr>{error}<hr>{logs_database}<hr>{$q->mysql_error}" . wizard_restart()); return; } echo $tpl->_ENGINE_parse_body("<center style='font-size:18px'>{statistics_database}:OK</center>\n\t\t\t<center style='font-size:18px'>{logs_database}:OK</center>") . "\n\t\t\t<div id='{$tt}'></div>\n\t\t\t<script>\n\t\t\tLoadAjax('{$t}','{$page}?wizard11=yes&t={$t}');\n\t\t\t</script>\n\t"; }