function events_list(){ include_once(dirname(__FILE__) . '/ressources/class.rtmm.tools.inc'); $tpl=new templates(); $page=CurrentPageName(); $search=$_GET["search"]; if(preg_match("#(.*?)isfailed#i",$search,$re)){$search=trim($re[1]);$success=" AND success=0";} $search="*$search*"; $search=str_replace("**","*",$search); $search=str_replace("*","%",$search); $sql="SELECT * FROM auth_events WHERE 1 AND (`ipaddr` LIKE '$search' $success) OR (`hostname` LIKE '$search' $success) OR (`uid` LIKE '$search' $success) ORDER BY ID DESC LIMIT 0,90"; $q=new mysql(); $results=$q->QUERY_SQL($sql,"artica_events"); if(!$q->ok){echo "<H2>$q->mysql_error</H2>";} $html=" <p> </p> <table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'> <thead class='thead'> <tr> <th width=1%> </th> <th width=1%> </th> <th width=1%>{date}</th> <th width=1%>{member}</th> <th>{hostname} $search</th> <th>{ipaddr}</th> </tr> </thead> <tbody class='tbody'>"; while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){ if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";} if($ligne["success"]==1){$img='fleche-20-right.png';}else{$img='fleche-20-red-right.png';} $flag=imgtootltip(GetFlags($ligne["Country"]),$ligne["Country"],null); $html=$html." <tr class=$classtr> <td style='font-size:14px;font-weight:bold'><img src=img/$img></td> <td style='font-size:14px;font-weight:bold'>$flag</td> <td style='font-size:14px;font-weight:bold' nowrap>{$ligne["zDate"]}</a></td> <td style='font-size:14px;font-weight:bold'>{$ligne["uid"]}</a></td> <td style='font-size:14px;font-weight:bold'>{$ligne["hostname"]}</a></td> <td style='font-size:14px;font-weight:bold'>{$ligne["ipaddr"]}</a></td> </tR>"; } $html=$html."</table>\n"; echo $tpl->_ENGINE_parse_body($html);return; }
function snort_query_search(){ $page=CurrentPageName(); $tpl=new templates(); include_once(dirname(__FILE__) . '/ressources/class.rtmm.tools.inc'); $limit=100; if(isset($_GET["zoom"])){$limit=200;} if(strlen($_GET["snort-query-search"])>1){ $search=$_GET["snort-query-search"]; $search="*$search*"; $search=str_replace("*","%",$search); $search=str_replace("%%","%",$search); } if(is_numeric($_GET["prio"])){$prio=" AND priority={$_GET["prio"]}";} if(strlen($_GET["classification"])>5){$classification=" AND classification='{$_GET["classification"]}'";} if($search<>null){ $quersearch="AND (hostname LIKE '$search'$prio$classification) OR (ipaddr LIKE '$search'$prio$classification) OR (port LIKE '$search'$prio$classification) OR (infos LIKE '$search'$prio$classification)"; }else{ $quersearch="$classification$prio"; } $sql="SELECT * FROM snort WHERE 1 $quersearch ORDER BY zDate DESC LIMIT 0,$limit"; $q=new mysql(); $results=$q->QUERY_SQL($sql,"artica_events"); if(!$q->ok){echo "<H2>$q->mysql_error</H2>";} $events=$q->COUNT_ROWS("snort","artica_events"); $events=FormatNumber($events,0,'.',' ',3); $html=" <p> </p> <div style='text-align:right'><i style='font-size:13px;font-weight:bold'>$events {events} | {your_ip_address}:{$_SERVER["REMOTE_ADDR"]} (".gethostbyaddr($_SERVER["REMOTE_ADDR"]).") </i></div> <table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'> <thead class='thead'> <tr> <th width=1%> </th> <th width=1%>{date}</th> <th>PRIO</th> <th>{hostname} $search</th> <th>{proto}</th> </tr> </thead> <tbody class='tbody'>"; while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){ if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";} if($ligne["success"]==1){$img='fleche-20-right.png';}else{$img='fleche-20-red-right.png';} $flag=imgtootltip(GetFlags($ligne["country"]),$ligne["country"],null); $html=$html." <tr class=$classtr> <td style='font-size:12px;font-weight:bold' width=1%>$flag</td> <td style='font-size:12px;font-weight:bold' width=1% nowrap>{$ligne["zDate"]}</a></td> <td style='font-size:12px;font-weight:bold' width=1% align='center'>{$ligne["priority"]}</a></td> <td style='font-size:12px;font-weight:bold' nowrap>{$ligne["hostname"]} [{$ligne["ipaddr"]}]</a></td> <td style='font-size:12px;font-weight:bold' nowrap>{port}:{$ligne["port"]} [{$ligne["proto"]}]</a></td> </tr> <tr class=$classtr> <td> </td> <td colspan=4 style='font-size:12px'>({$ligne["classification"]}) <i>{$ligne["infos"]}</i></td> </tr>"; } $html=$html."</table>\n"; echo $tpl->_ENGINE_parse_body($html);return; }
function not_categorized_list(){ $tpl=new templates(); $categorize_this_query=$tpl->_ENGINE_parse_body("{categorize_this_query}"); $page=CurrentPageName(); if($_COOKIE["SQUID_NOT_CAT_SEARCH"]<>null){ $pattern=" AND website LIKE '%{$_COOKIE["SQUID_NOT_CAT_SEARCH"]}%' "; $pattern=str_replace("*","%",$pattern); $categorize_all="<div style='font-size:14px;text-align:right;margin-bottom:5px'> <a href='javascript:blur();' style='font-size:14px;text-decoration:underline' OnClick=\"javascript:CategorizeAll('{$_COOKIE["SQUID_NOT_CAT_SEARCH"]}');\">{categorize_this_query}</a></div> "; } $sql="SELECT * FROM `squid_events_sites` WHERE `category`='' $pattern ORDER BY hits DESC LIMIT 0 , 100"; $html=" $categorize_all <table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'> <thead class='thead'> <tr> <th>{country}</th> <th>{website}</th> <th>{hits}</th> <th> </th> </tr> </thead> <tbody class='tbody'>"; $q=new mysql(); $results=$q->QUERY_SQL($sql,"artica_events"); if(!$q->ok){echo "<H2>$q->mysql_error</H2>";} while($ligne=mysql_fetch_array($results,MYSQL_ASSOC)){ if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";} if($ligne["country"]<>null){ if($_SESSION["COUNTRIES_FLAGS"][$ligne["country"]]==null){ $_SESSION["COUNTRIES_FLAGS"][$ligne["country"]]=GetFlags($ligne["country"]); } } if($_SESSION["COUNTRIES_FLAGS"][$ligne["country"]]==null){$_SESSION["COUNTRIES_FLAGS"][$ligne["country"]]="flags/a2.png";} $country_text="<strong style=font-size:13px>{$ligne["country"]}<br>{$ligne["ipaddr"]}</strong>"; $country=imgtootltip($_SESSION["COUNTRIES_FLAGS"][$ligne["country"]],$country_text); $delete=imgtootltip("delete-24.png","{delete}","RoutesServerDelete('{$ligne["ipaddr"]}')"); $html=$html." <tr class=$classtr> <td width=1% valign='middle' aling='center'>$country</td> <td width=99%><strong style='font-size:14px'>{$ligne["website"]}</td> <td width=19%><strong style='font-size:14px'>{$ligne["hits"]}</td> <td width=1%>". imgtootltip("add-database-32.png","{categorize}","Loadjs('squid.categorize.php?www={$ligne["website"]}')")."</td> </tr> "; } $html=$html."</tbody> </table> "; $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }
function countries_month() { $tpl = new templates(); $page = CurrentPageName(); $sql = "SELECT SUM(hits) as thits,country FROM kav4proxyDays WHERE MONTH(days)=MONTH(NOW()) AND YEAR(days)=YEAR(NOW()) GROUP BY country ORDER BY thits DESC LIMIT 0,10"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { echo "<H2>{$q->mysql_error}\n</H2>"; return; } $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%><img src=img/domain-64.png></td>\n\t<td><div class=explain>{kav4proxycountry_month_stats_explain}</div></td>\n\t</tr>\n\t</table>\n\t<center style='margin:5px'><img src='ressources/logs/web/kav4proxy.MCOUNT.png' border=0></center>\n\t\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1% colspan=2>{hits}</th>\n\t\t<th width=1%>{country}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; $gp->xdata[] = ""; $gp->ydata[] = ""; @unlink(dirname(__FILE__) . "/ressources/logs/web/kav4proxy.MCOUNT.png"); $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/kav4proxy.MCOUNT.png", 0); while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $gp->xdata[] = $ligne["thits"]; $text_category = $ligne["country"]; $country = $ligne["country"]; if ($country != null) { $img_country = GetFlags($country); } else { $img_country = "flags/name.png"; } if ($text_category == null) { $text_category = $tpl->_ENGINE_parse_body("{unknown}"); } $gp->ydata[] = $text_category; $html = $html . "<tr class={$classtr}>\n\t\t\t<td width=1% nowrap><img src='img/{$img_country}'></td>\n\t\t\t<td width=1% nowrap><strong style='font-size:14px'>{$ligne["thits"]}</strong></td>\n\t\t\t<td width=99% nowrap align=left><strong style='font-size:14px'>{$text_category}</strong></td>\n\t\t\t</tr>\n\t\t\t"; } $html = $html . "\n\t</tbody>\n\t</table>\n\t"; $gp->width = 560; $gp->height = 580; $gp->ViewValues = false; $gp->x_title = "{country}"; $gp->pie(); echo $tpl->_ENGINE_parse_body($html); }
function last_events() { $q = new mysql(); $myYear = date('Y'); $today = date('Y-m-d'); $cache = GET_CACHED("squid_filter", "filter", "settings", true); if ($cache != null) { $settings = unserialize($cache); } if ($settings["Q_CLIENT"] != null) { if ($settings["Q_CLIENT"] != "0") { $Q_CLIENT = " AND `CLIENT`='{$settings["Q_CLIENT"]}'"; } } if (preg_match("#d([0-9]+)#", $settings["Q_TIME"], $re)) { $Q_TIME = " AND `zDate`<= DATE_ADD(NOW(),INTERVAL -{$re[1]} DAY)"; } if ($settings["Q_TIME"] == "w1") { $Q_FIELD_ADD1 = ", WEEK(zdate) as tweek"; $Q_TIME = " AND tweek=WEEK(NOW())"; } if ($settings["Q_TIME"] == "w2") { //$Q_FIELD_ADD1=", WEEK(dansguardian_events.zdate) AS tweek"; $Q_TIME = " AND WEEK(dansguardian_events.zdate)=WEEK(NOW())-1"; } if ($settings["Q_EVENTS_NUM"] == null) { $settings["Q_EVENTS_NUM"] = 200; } $sql = "SELECT dansguardian_events.*{$Q_FIELD_ADD1} FROM `dansguardian_events` WHERE 1{$Q_CLIENT}{$Q_TIME} ORDER BY ID DESC LIMIT 0,{$settings["Q_EVENTS_NUM"]}"; $results = $q->QUERY_SQL($sql, "artica_events"); $tpl = new templates(); if (!$q->ok) { echo $q->mysql_error . "<hr>" . htmlspecialchars($sql) . "<hr>"; return; } $num_rows = mysql_num_rows($results); $html = $tpl->_ENGINE_parse_body("\n\t<H3>{$num_rows} {events}</H3>\n\t<table style='width:100%'>"); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $country = $ligne["country"]; $date = $ligne["zDate"]; $date = str_replace("{$today}", "{today}", $date); $date = str_replace("{$myYear}-", "", $date); $style = 'font-size:12px'; $QuerySize = round($ligne["QuerySize"] / 1024, 1) . " Kb"; if ($country != null) { $img_country = GetFlags($country); } else { $img_country = "flags/name.png"; } $ligne["sitename"] = texttooltip($ligne["sitename"], "{display_statistics_of_this_website}", "WebSiteStatistics('{$ligne["sitename"]}')", null, 0, $style); $ligne["CLIENT"] = texttooltip($ligne["CLIENT"], "{display_statistics_of_this_user}", "WebClientStatistics('{$ligne["CLIENT"]}')", null, 0, $style); $html = $html . "<tr " . CellRollOver() . ">"; $html = $html . "<td valign='top' width=1% style='{$style}'>" . imgtootltip($img_country, "<li style=font-size:14px>{$ligne["remote_ip"]}</li><li style=font-size:14px>{$country}</li>") . "</td>"; $html = $html . "<td valign='top' width=1% style='{$style}' nowrap>{$date}</td>"; $html = $html . "<td valign='top' width=1% style='{$style}'>{$ligne["CLIENT"]}</td>"; $html = $html . "<td valign='top' width=1% style='{$style}'><img src='img/fw_bold.gif'></td>"; $html = $html . "<td valign='top' width=1% style='{$style}'>{$ligne["sitename"]}</td>"; $html = $html . "<td valign='top' width=1% style='{$style}' nowrap align='right'>{$QuerySize}</td>"; $html = $html . "</tr>"; $html = $tpl->_ENGINE_parse_body($html); } $html = $html . "</table>"; echo $html; }
function popup() { $www = $_GET["www"]; $md = md5($www); $page = CurrentPageName(); $tpl = new templates(); $q = new mysql_squid_builder(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM visited_sites WHERE sitename='{$www}'")); $time = time(); $country = $ligne["country"]; $year = $_GET["year"]; if (!is_numeric($year)) { $year = date('Y'); } if (is_numeric($_GET["week"])) { $tablename = "{$year}{$_GET["week"]}_week"; $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(hits) as HitsNumber,SUM(size) as Querysize FROM {$tablename} WHERE sitename='{$www}'")); if (!$q->ok) { echo $q->mysql_error; } $CALC = true; $rq_title = "{weekly}"; } if (!$CALC) { if (is_numeric($_GET["xtime"])) { $table = date("Ymd", $_GET["xtime"]) . "_hour"; if ($q->TABLE_EXISTS($table)) { $sql = "SELECT SUM(hits) as HitsNumber, SUM(size) as Querysize FROM {$table} WHERE familysite='{$www}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); if (!$q->ok) { echo $q->mysql_error; } $CALC = true; $rq_title = "{daily}"; $rq_title_suffix = " (" . date("{l} {F} d") . ")"; } } } if (!$CALC) { if ($q->TABLE_EXISTS("visited_sites_days")) { $sql = "SELECT SUM(hits) as HitsNumber, SUM(size) as Querysize FROM visited_sites_days WHERE familysite='{$www}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); if (!$q->ok) { echo $q->mysql_error; } $CALC = true; $rq_title = "{all_days}"; } } if ($CALC) { $requests = numberFormat($ligne["HitsNumber"], 0, "", " "); $totalsize = FormatBytes($ligne["Querysize"] / 1024); $vsiz = "\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:14px'>{requests} ({$rq_title}):</td>\n\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$requests}{$rq_title_suffix}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:14px'>{size}:</td>\n\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$totalsize}</td>\n\t\t\t</tr>\t"; } if ($country != null) { $img_country = GetFlags($country); } else { $img_country = "flags/name.png"; } $html = "\n\t<table style='width:100%;margin-bottom:10px'>\n\t<tr>\n\t\t<td style='width:0.5%'><img src='img/{$img_country}'></td>\n\t<td>\n\t\t<div style='font-size:18px' class=legend>{$www} ({$country})</div>\n\t</td>\n\t</tr>\n\t</table>\n\t\n\t\n\t\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td width=400px valign='top'>\n\t\t\t<div id='thumbs-{$md}' class=BodyContent>\n\t\t\t\t\n\t\t\t\t<div style='width:99% class=form><img src='squid.statistics.php?thumbnail={$www}&t={$time}' class='rounded'></div>\n\t\t\t\t</div>\n\t\t\t\n\t\t\t</div>\n\t\t\t\n\t\t</td>\n\t\t<td valign='top'>\n\t\t<div class=BodyContent>\n\t\t\t<table style='width:100%'>\n\t\t\t{$vsiz}\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:14px' valign='top'>{categories}:</td>\n\t\t\t\t<td style='font-size:14px;font-weight:bold'><div id='catz-{$md}'></div></td>\n\t\t\t</tr>\t\t\t\t\t\n\t\t\t</table>\n\t\t\t<div id='siteinfos-{$md}'></div>\n\t\t</div>\n\t\t</td>\n\t</tr>\n\t</table>\n\t\n\t\n\t\n\t\n\t<script>\n\t\tfunction RefreshAllSiteZoom(){\n\t\t\tCornPictures();\n\t\t\tLoadAjaxTiny('catz-{$md}','squid.search.statistics.php?search-stats-categories={$www}');\n\t\t\tLoadAjaxTiny('siteinfos-{$md}','squid.search.statistics.php?site-infos={$www}&idcallback=siteinfos-{$md}&disposition=1column&gen-thumbnail=yes');\n\t\t\t}\n\t\t\n\t\tfunction GenerateThumbs(){\n\t\t\tLoadAjax('siteinfos-{$md}','{$page}?thumbnail={$www}');\n\t\t\n\t\t}\n\t\t\n\t\tfunction ReGenerateThumbs(){\n\t\t\tLoadAjax('siteinfos-{$md}','{$page}?rethumbnail={$www}');\n\t\t}\n\t\t\n\t\tGenerateThumbs();\n\t\t\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
} if (CheckFlags("M", $vflag)) { $vflag = "M"; } if (CheckFlags("m", $vflag)) { $vflag = "m"; } if (CheckFlags("Z", $vflag)) { $vflag = "Z"; } if (CheckFlags("X", $vflag)) { $vflag = ereg_replace("[ADRpFsoiIOCBbra]", "", $vflag); } ChangeUser($login, $password, $selecteduser, $vflag, $chatpath); } else { $flags = GetFlags($selecteduser, $chatpath); echo "<table cellspacing=0 cellpadding=2 border=0>\n"; echo "<tr><td colspan=3 bgcolor=#FFFFFF></td></tr>"; echo "<tr>"; echo "<td><input type=checkbox name=fl_mm " . (CheckFlags("M", $flags) ? "CHECKED" : "") . "> System Master</td>\n"; echo "<td><input type=checkbox name=fl_m " . (CheckFlags("m", $flags) ? "CHECKED" : "") . "> Chat Master</td>\n"; echo "<td><input type=checkbox name=fl_zz " . (CheckFlags("Z", $flags) ? "CHECKED" : "") . "> Master</td>\n"; echo "</tr>\n"; echo "<tr><td colspan=3 bgcolor=#FFFFFF></td></tr>"; echo "<tr>"; echo "<td><input type=checkbox name=fl_xx " . (CheckFlags("X", $flags) ? "CHECKED" : "") . "> Administrator</td>\n"; echo "<td><input type=checkbox name=fl_x " . (CheckFlags("x", $flags) ? "CHECKED" : "") . "> Moderator</td>\n"; echo "<td><input type=checkbox name=fl_z " . (CheckFlags("z", $flags) ? "CHECKED" : "") . "> OOC</td>\n"; echo "</tr>\n"; echo "<tr>"; echo "<td><input type=checkbox name=fl_pp " . (CheckFlags("P", $flags) ? "CHECKED" : "") . "> Protected</td>\n";
function list_table() { $MyPage = CurrentPageName(); $page = 1; $tpl = new templates(); $q = new mysql(); if (!$q->TABLE_EXISTS("smtp_logs", "artica_events")) { $q->BuildTables(); } $table = "smtp_logs"; $t = $_GET["t"]; $database = "artica_events"; $FORCE_FILTER = 1; if (!$q->TABLE_EXISTS("smtp_logs", "artica_events")) { json_error_show("!Error: artica_events No such table"); } if ($q->COUNT_ROWS($table, $database) == 0) { json_error_show("No item"); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); if (!$q->ok) { json_error_show("{$q->mysql_error}"); } $total = $ligne["TCOUNT"]; if ($total == 0) { json_error_show("No rows for {$searchstring}"); } } else { $total = $q->COUNT_ROWS($table, $database); } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE {$FORCE_FILTER} {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { json_error_show("{$q->mysql_error}<hr>{$sql}<hr>"); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (mysql_num_rows($results) == 0) { json_error_show("No data...", 1); } $today = date('Y-m-d'); $style = "font-size:14px;"; $ini = GetColor(); $unknown = $tpl->_ENGINE_parse_body("{unknown}"); while ($line = mysql_fetch_assoc($results)) { $Country = $line["Country"]; $country_img = GetFlags($Country); $Region = $line["Region"]; $smtp_sender = $line["smtp_sender"]; $SPAM = $line["SPAM"]; $rcpt = $line["delivery_user"]; $mailfrom = $line["sender_user"]; $bounce_error = trim($line["bounce_error"]); $time = $line["time_connect"]; $time = str_replace($today, "", $time); $spammy = $line["spammy"]; $bg_color = null; if ($spammy == 1) { $bounce_error = "SPAMMY"; } if ($SPAM == 1) { $bounce_error = "SPAM"; } $bounce_error_key = str_replace(" ", "_", $bounce_error); if (isset($ini[$bounce_error_key])) { $bg_color = "background-color:{$ini[$bounce_error_key]["row_color"]};color:{$ini[$bounce_error_key]["text_color"]};margin:-5px;padding:5px;font-weight:bold"; } if ($mailfrom == null) { $mailfrom = "{$unknown}"; } if ($rcpt == null) { $rcpt = "{$unknown}"; } if ($bounce_error == "Sended") { $bounce_error = $tpl->javascript_parse_text("{sended}"); } $js = "Loadjs('{$MyPage}?zoom-js=yes&id={$line["id"]}&hostname={$_GET["hostname"]}&ou={$_GET["ou"]}')"; $md = md5(serialize($ligne)); $cells = array(); $cells[] = "<img src='img/{$country_img}'>"; $cells[] = "<span style='font-size:14px;'>{$time}</span>"; $cells[] = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:14px;text-decoration:underline'>{$mailfrom}</a>"; $cells[] = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:14px;text-decoration:underline'>{$rcpt}</a>"; $cells[] = "<span style='font-size:11px;'><div style='{$bg_color};text-transform:capitalize;font-size:14px;'>{$bounce_error}</div></span>"; $data['rows'][] = array('id' => $line["id"], 'cell' => $cells); } echo json_encode($data); }
function not_categorized_list() { $tpl = new templates(); $categorize_this_query = $tpl->_ENGINE_parse_body("{categorize_this_query}"); $page = CurrentPageName(); $day = trim($_GET["day"]); if ($_COOKIE["SQUID_NOT_CAT_SEARCH"] != null) { $pattern = " AND sitename LIKE '%{$_COOKIE["SQUID_NOT_CAT_SEARCH"]}%' "; $pattern = str_replace("*", "%", $pattern); $categorize_all = "<div style='font-size:14px;text-align:right;margin-bottom:5px'>\n\t\t<a href='javascript:blur();' style='font-size:14px;text-decoration:underline' OnClick=\"javascript:CategorizeAll('{$_COOKIE["SQUID_NOT_CAT_SEARCH"]}');\">{categorize_this_query}</a></div>\n\t\t\n\t\t"; } $sql = "SELECT * FROM `visited_sites` WHERE LENGTH(category)=0 {$pattern} ORDER BY HitsNumber DESC LIMIT 0 , 100"; $day = trim($_GET["day"]); if ($day != null) { $time = strtotime("{$day} 00:00:00"); $table = date("Ymd", $time) . "_hour"; if ($_COOKIE["SQUID_NOT_CAT_SEARCH"] != null) { $pattern = " HAVING sitename LIKE '%{$_COOKIE["SQUID_NOT_CAT_SEARCH"]}%' "; $pattern = str_replace("*", "%", $pattern); } if ($pattern == null) { $pattern = "HAVING LENGTH(category)=0"; } else { $pattern = $pattern . " AND LENGTH(category)=0"; } $sql = "SELECT SUM(hits) as HitsNumber, sitename,category,country FROM {$table} \n\t\tGROUP BY sitename,category,country {$pattern} ORDER BY HitsNumber DESC LIMIT 0,100"; } $html = "\n{$categorize_all}\t\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t<th>{country}</th>\n\t<th>{website} {$day}</th>\n\t<th>{hits}</th>\n\t<th> </th>\t\n\t</tr>\n</thead>\n<tbody class='tbody'>"; $q = new mysql_squid_builder(); $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $ligne["website"] = $ligne["sitename"]; if ($ligne["country"] != null) { if ($_SESSION["COUNTRIES_FLAGS"][$ligne["country"]] == null) { $_SESSION["COUNTRIES_FLAGS"][$ligne["country"]] = GetFlags($ligne["country"]); } } if ($_SESSION["COUNTRIES_FLAGS"][$ligne["country"]] == null) { $_SESSION["COUNTRIES_FLAGS"][$ligne["country"]] = "flags/a2.png"; } $country_text = "<strong style=font-size:13px>{$ligne["country"]}<br>{$ligne["ipaddr"]}</strong>"; $country = imgtootltip($_SESSION["COUNTRIES_FLAGS"][$ligne["country"]], $country_text); $delete = imgtootltip("delete-24.png", "{delete}", "RoutesServerDelete('{$ligne["ipaddr"]}')"); $html = $html . "\n\t\t\t<tr class={$classtr}>\n\t\t\t<td width=1% valign='middle' aling='center'>{$country}</td>\n\t\t\t<td width=99%><strong style='font-size:14px'>{$ligne["website"]}</td>\n\t\t\t<td width=19%><strong style='font-size:14px'>{$ligne["HitsNumber"]}</td>\n\t\t\t<td width=1%>" . imgtootltip("add-database-32.png", "{categorize}", "Loadjs('squid.categorize.php?www={$ligne["website"]}&day={$_GET["day"]}')") . "</td>\n\t\t\t</tr>\n\t\t\t"; } $html = $html . "</tbody>\n\t</table>\n\t\n\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function ChangePass($username, $password, $chatpath) { global $handler; if (CheckFlags("M", GetFlags($username, $chatpath))) { echo "Nice try."; return 0; } @count_mysql_query("UPDATE uo_chat_database SET password='******' WHERE chat='{$chatpath}' AND username='******' AND dtime IS NULL", $handler); $username = ucwords($username); $fc = fopen("wizard_locked/actionlog.log", "a"); fwrite($fc, stripslashes(date("F d, Y T - H:i:s") . ": User '{$username}' changed password.\n")); fclose($fc); return 1; }
function events_list() { include_once dirname(__FILE__) . '/ressources/class.rtmm.tools.inc'; $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql(); $search = '%'; $table = "auth_events"; $page = 1; $ORDER = "ORDER BY zDate DESC"; $total = 0; if ($q->COUNT_ROWS($table, "artica_events") == 0) { $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); echo json_encode($data); return; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); $total = $ligne["TCOUNT"]; } else { $total = $q->COUNT_ROWS($table, "artica_events"); } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error); } if (mysql_num_rows($results) == 0) { json_error_show("no data"); } $span = "<span style='font-size:18px;font-weight:normal'>"; while ($ligne = mysql_fetch_assoc($results)) { if ($ligne["success"] == 1) { $img = 'fleche-20-right.png'; } else { $img = 'fleche-20-red-right.png'; } $flag = imgsimple(GetFlags($ligne["Country"]), $ligne["Country"], null); $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<img src=img/{$img}>", $flag, "{$span}{$ligne["zDate"]}</span>", "{$span}{$ligne["uid"]}</span>", "{$span}{$ligne["hostname"]}</span>", "{$span}{$ligne["ipaddr"]}</span>")); } echo json_encode($data); }
function categorized_list(){ $_COOKIE["SQUID_NOT_CAT_SEARCH"]=trim($_COOKIE["SQUID_NOT_CAT_SEARCH"]); if($_COOKIE["SQUID_NOT_CAT_SEARCH"]<>null){ $pattern=" AND sitename LIKE '%{$_COOKIE["SQUID_NOT_CAT_SEARCH"]}%' "; $pattern=str_replace("*","%",$pattern); } $sql="SELECT * FROM `squid_events_sites` WHERE `category` != '' $pattern ORDER by hits DESC LIMIT 0 , 100"; $sql="SELECT sitename ,visited_sites.* FROM visited_sites WHERE 1 $pattern AND LENGTH(category)>1 ORDER BY HitsNumber DESC LIMIT 0,100"; $page=CurrentPageName(); $day=trim($_GET["day"]); if($day<>null){ $time=strtotime("$day 00:00:00"); $table=date("Ymd",$time)."_hour"; if($_COOKIE["SQUID_NOT_CAT_SEARCH"]<>null){$pattern=" HAVING sitename LIKE '%{$_COOKIE["SQUID_NOT_CAT_SEARCH"]}%' ";$pattern=str_replace("*","%",$pattern);} if($pattern==null){$pattern="HAVING LENGTH(category)>2";}else{$pattern=$pattern ." AND LENGTH(category)>2";} $sql="SELECT SUM(hits) as HitsNumber, sitename,category,country FROM $table GROUP BY sitename,category,country $pattern ORDER BY HitsNumber DESC LIMIT 0,100"; } $q=new mysql_squid_builder(); $results=$q->QUERY_SQL($sql); if(!$q->ok){echo "<H2>$q->mysql_error</H2>";} $maxrow=mysql_num_rows($results); $html=" <table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'> <thead class='thead'> <tr> <th>{country}</th> <th>{website} ($maxrow {items}) $day</th> <th>{hits}</th> <th> </th> </tr> </thead> <tbody class='tbody'>"; while($ligne=mysql_fetch_array($results,MYSQL_ASSOC)){ if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";} if($ligne["country"]<>null){ if($_SESSION["COUNTRIES_FLAGS"][$ligne["country"]]==null){ $_SESSION["COUNTRIES_FLAGS"][$ligne["country"]]=GetFlags($ligne["country"]); } } if($_SESSION["COUNTRIES_FLAGS"][$ligne["country"]]==null){$_SESSION["COUNTRIES_FLAGS"][$ligne["country"]]="flags/a2.png";} $ligne["dbpath"]=str_replace(",",", ",$ligne["dbpath"]); $country_text="<strong style=font-size:13px>{$ligne["country"]}<br>{$ligne["ipaddr"]}</strong>"; $country=imgtootltip($_SESSION["COUNTRIES_FLAGS"][$ligne["country"]],$country_text); $delete=imgtootltip("delete-24.png","{delete}","RoutesServerDelete('$ip')"); $html=$html." <tr class=$classtr> <td width=1% valign='middle' aling='center'>$country</td> <td width=99%><strong style='font-size:14px'>{$ligne["sitename"]}<br><i style='font-size:11px;color:#970909'>{$ligne["category"]}</i></td> <td width=1%><strong style='font-size:14px'>{$ligne["HitsNumber"]}</td> <td width=1%>". imgtootltip("add-database-32.png","{categorize}","Loadjs('squid.categorize.php?www={$ligne["sitename"]}')")."</td> </tr> "; } $html=$html."</tbody></table>"; $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }
function blocked_ip_identity_infos() { include_once 'ressources/class.rtmm.tools.inc'; $page = CurrentPageName(); $tpl = new templates(); $ip = $_GET["ip"]; $hostname = gethostbyaddr($ip); if ($hostname == null) { $hostname = "{unknown}"; } if (function_exists("geoip_record_by_name")) { $record = geoip_record_by_name($ip); if ($record) { $country = $record["country_name"]; $city = $record["city"]; } } if ($country != null) { $country = "<table><tr><td width=1%><img src='img/" . GetFlags($country) . "'></td><td style='font-size:14px'>{$country}</td></tr></table>"; if ($city == null) { $city = "{unknown}"; } } else { $country = "{unknown}"; $city = "{unknown}"; } $sock = new sockets(); $datas = explode(";", $sock->getFrameWork("cmd.php?rbl-check={$ip}")); if ($datas[0] != null) { $rbl = "<tr>\n\t\t<td class=legend>RBL:</td>\n\t\t<td style='font-size:14px'><a href=\"javascript:blur();\" OnClick=\"javascript:s_PopUpFull('{$datas[1]}',600,800,'{$datas[1]}::{$ip}');\" style='text-decoration:underline;font-size:14px'>{$datas[0]}</a></td>\n\t\t</tr>"; } else { $rbl = "<tr>\n\t\t<td class=legend>RBL:</td>\n\t\t<td style='font-size:14px'>{unknown}</td>\n\t\t</tr>"; } $html = "\n\t<table class=form>\n\t<tr>\n\t\t<td class=legend>{hostname}:</td>\n\t\t<td style='font-size:14px'>{$hostname}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{country}:</td>\n\t\t<td style='font-size:14px'>{$country}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{city}:</td>\n\t\t<td style='font-size:14px'>{$city}</td>\n\t</tr>\n\t\t{$rbl}\n\t</table>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
$html = "\n<div style='float:right;margin:5px'>" . imgtootltip("refresh-24.png", "{refresh}", "RefreshTab('admin_perso_tabs')") . "</div><div style='font-size:14px;font-weight:bold;margin-bottom:5px'>{$lignetotal} {events}</div>\n<div style='width:100%;height:450px;overflow:auto'>\n<table style='width:100%'>"; writelogs("running master query", __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { $unix->send_email_events("Unable to execute last Proxy events (" . basename(__FILE__) . ")", "on line " . __LINE__ . "\n{$q->mysql_error}", "proxy"); die("Wrong query"); } $numberofSites = mysql_num_rows($results); if (system_is_overloaded(basename(__FILE__))) { $unix->send_email_events("Overloaded system: failed generate last {$numberofSites} Proxy events", "", "proxy"); die; } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $count = $count + 1; $Country = $ligne["country"]; $country_img = GetFlags($Country); if ($ligne["TYPE"] == null) { $ligne["TYPE"] = "PASS"; } if (preg_match("#EXCEPTION#", $ligne["TYPE"])) { $ligne["TYPE"] = "PASS"; } switch (strtolower($ligne["TYPE"])) { case "pass": $roll = CellRollOver(); $color = "black"; break; case "not modified": $roll = CellRollOver(); $color = "black"; break;