本文整理汇总了PHP中mysql_squid_builder::HIER方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql_squid_builder::HIER方法的具体用法?PHP mysql_squid_builder::HIER怎么用?PHP mysql_squid_builder::HIER使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql_squid_builder
的用法示例。
在下文中一共展示了mysql_squid_builder::HIER方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page
function page()
{
$page = CurrentPageName();
$tpl = new templates();
$q = new mysql_squid_builder();
if (!isset($_GET["day"])) {
$_GET["day"] = $q->HIER();
}
if ($_GET["day"] == null) {
$_GET["day"] = $q->HIER();
}
$member = $tpl->_ENGINE_parse_body("{member}");
$delete = $tpl->_ENGINE_parse_body("{delete}");
$hits = $tpl->_ENGINE_parse_body("{hits}");
$size = $tpl->_ENGINE_parse_body("{size}");
$sitename = $tpl->_ENGINE_parse_body("{sitename}");
$ipaddr = $tpl->_ENGINE_parse_body("{ipaddr}");
$members = $tpl->_ENGINE_parse_body("{members}");
$hostname = $tpl->_ENGINE_parse_body("{hostname}");
$mac = $tpl->_ENGINE_parse_body("{MAC}");
$week = $tpl->_ENGINE_parse_body("{week}");
$month = $tpl->_ENGINE_parse_body("{month}");
$TB_WIDTH = 550;
$t = time();
$buttons = "\n\tbuttons : [\n\t{name: '<b>{$week}</b>', bclass: 'Calendar', onpress : ChangeWeek{$t}},\n\t{name: '<b>{$month}</b>', bclass: 'Calendar', onpress : ChangeMonth{$t}},\n\t\n\t\t],";
$html = "\n\t<table class='{$t}' style='display: none' id='{$t}' style='width:99%'></table>\n<script>\n\n\$(document).ready(function(){\n\$('#{$t}').flexigrid({\n\turl: '{$page}?search=yes',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$member}', name : 'uid', width : 120, sortable : true, align: 'left'},\n\t\t{display: '{$ipaddr}', name : 'ipaddr', width : 120, sortable : true, align: 'left'},\n\t\t{display: '{$hostname}', name : 'hostname', width : 167, sortable : true, align: 'left'},\n\t\t{display: '{$mac}', name : 'MAC', width : 139, sortable : true, align: 'left'},\n\t\t{display: '{$size}', name : 'QuerySize', width : 132, sortable : false, true: 'left'},\n\t\t{display: '{$hits}', name : 'hits', width : 101, sortable : false, true: 'left'},\n\t\t\n\t\t\n\t],{$buttons}\n\tsearchitems : [\n\t\t{display: '{$member}', name : 'uid'},\n\t\t{display: 'TCP/IP', name : 'ipaddr'},\n\t\t{display: '{$hostname}', name : 'hostname'},\n\t\t{display: '{$mac}', name : 'MAC'},\n\t\t],\n\tsortname: 'QuerySize',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '{$members}»',\n\tuseRp: true,\n\trp: 15,\n\tshowTableToggleBtn: false,\n\twidth: 872,\n\theight: 450,\n\tsingleSelect: true\n\t\n\t});\n});\n\nfunction RefreshNodesSquidTbl(){\n\t\$('#{$t}').flexReload();\n}\n\nfunction ChangeDay{$t}(){\n\tYahooWin(400,'{$page}?change-day=yes&t={$t}','{$day}');\n}\n\nfunction ChangeWeek{$t}(){\n\tYahooWin(650,'{$page}?change-week=yes&t={$t}','{$week}');\n}\nfunction ChangeMonth{$t}(){\n\tYahooWin(400,'{$page}?change-month=yes&t={$t}','{$month}');\n}\n</script>";
echo $html;
}
示例2: page
function page()
{
$page = CurrentPageName();
$tpl = new templates();
$q = new mysql_squid_builder();
$member = $tpl->_ENGINE_parse_body("{member}");
$delete = $tpl->_ENGINE_parse_body("{delete}");
$hits = $tpl->_ENGINE_parse_body("{hits}");
$size = $tpl->_ENGINE_parse_body("{size}");
$sitename = $tpl->_ENGINE_parse_body("{sitename}");
$date = $tpl->_ENGINE_parse_body("{date}");
$members = $tpl->_ENGINE_parse_body("{members}");
$hostname = $tpl->_ENGINE_parse_body("{hostname}");
$day = $tpl->_ENGINE_parse_body("{day}");
$week = $tpl->_ENGINE_parse_body("{week}");
$ipaddr = $tpl->_ENGINE_parse_body("{ipaddr}");
$hosts = $tpl->_ENGINE_parse_body("{hosts}");
$cache = $tpl->_ENGINE_parse_body("{cached}");
$websites = $tpl->_ENGINE_parse_body("{websites}");
$TB_WIDTH = 550;
$t = time();
if (!isset($_GET["day"])) {
$_GET["day"] = $q->HIER();
}
$buttons = "\n\t\tbuttons : [\n\t\t{name: '<b>{$day}</b>', bclass: 'Calendar', onpress : ChangeDay{$t}},\n\t\n\t\t],";
$html = "\n\t\t<table class='{$t}' style='display: none' id='{$t}' style='width:99%'></table>\n<script>\n\nfunction LoadTable{$t}(){\n\t\t\$('#{$t}').flexigrid({\n\t\turl: '{$page}?rows=yes&day={$_GET["day"]}',\n\t\tdataType: 'json',\n\t\tcolModel : [\n\t\t{display: '{$websites}', name : 'site', width : 490, sortable : true, true: 'left'},\n\t\t{display: '{$members}', name : 'users', width : 73, sortable : true, align: 'left'},\n\t\t{display: '{$hosts}', name : 'hosts', width : 57, sortable : true, align: 'left'},\n\t\t{display: '{$size}', name : 'hosts', width : 90, sortable : true, align: 'left'},\n\t\t{display: '{$cache}', name : 'cachePercent', width : 58, sortable : true, true: 'left'},\n\t\t\n\t\n\t\n\t\t],{$buttons}\n\t\tsearchitems : [\n\t\t{display: '{$websites}', name : 'site'},\t\n\t\t],\n\t\tsortname: 'bytes',\n\t\tsortorder: 'desc',\n\t\tusepager: true,\n\t\ttitle: '{$websites}»{$_GET["day"]}',\n\t\tuseRp: true,\n\t\trp: 15,\n\t\tshowTableToggleBtn: false,\n\t\twidth: 842,\n\t\theight: 450,\n\t\tsingleSelect: true\n\t\n\t});\n}\n\t\n\tfunction RefreshNodesSquidTbl(){\n\t\$('#{$t}').flexReload();\n\t}\n\t\n\tfunction ChangeDay{$t}(){\n\t\tYahooWin(400,'{$page}?change-day=yes&t={$t}','{$day}');\n\t}\n\t\n\tfunction ChangeWeek{$t}(){\n\t\tYahooWin(624,'{$page}?change-week=yes&t={$t}','{$week}');\n\t}\n\tfunction ChangeMonth{$t}(){\n\t\tYahooWin(400,'{$page}?change-month=yes&t={$t}','{$month}');\n\t}\n\t\n\t\n\tLoadTable{$t}()\n\t</script>";
echo $html;
}
示例3: today_zoom_popup
function today_zoom_popup()
{
$page = CurrentPageName();
$q = new mysql_squid_builder();
$tpl = new templates();
if (!isset($_GET["day"])) {
$_GET["day"] = $q->HIER();
}
$t = time();
$today = "{today}";
if ($_GET["day"] != date("Y-m-d")) {
$time = strtotime("{$_GET["day"]} 00:00:00");
$today = date("{l} d {F}", $time);
}
$tpl = new templates();
$array["website-zoom"] = '{website}';
$array["website-catz"] = '{categories}';
$array["today-zoom-popup-history"] = "{history}:{$today}";
$array["today-zoom-popup-members"] = "{members}:{$today}";
while (list($num, $ligne) = each($array)) {
if ($num == "website-zoom") {
$html[] = "<li><a href=\"squid.website-zoom.php?sitename={$_GET["familysite"]}&day={$_GET["day"]}\"><span>{$ligne}</span></a></li>\n";
continue;
}
if ($num == "website-catz") {
$html[] = "<li><a href=\"squid.categorize.php?popup=yes&www={$_GET["familysite"]}&bykav=&day={$_GET["day"]}&group=&table-size=993&row-explain=764\"><span>{$ligne}</span></a></li>\n";
continue;
}
$html[] = "<li><a href=\"{$page}?{$num}=yes&day={$_GET["day"]}&type={$_GET["type"]}&familysite={$_GET["familysite"]}\"><span style='font-size:14px'>{$ligne}</span></a></li>\n";
}
$t = time();
echo build_artica_tabs($html, $t);
}
示例4: tabs
function tabs()
{
$q = new mysql_squid_builder();
$page = CurrentPageName();
$tpl = new templates();
if (!isset($_GET["day"])) {
$_GET["day"] = $q->HIER();
}
$t = time();
$tpl = new templates();
$array["panel"] = '{panel}';
$array["graph"] = '{graphs}';
while (list($num, $ligne) = each($array)) {
$ligne = $tpl->_ENGINE_parse_body("{$ligne}");
$html[] = "<li><a href=\"{$page}?familysite={$_GET["familysite"]}&filterby={$_GET["filterby"]}&filterdata={$_GET["filterdata"]}&sitename={$_GET["sitename"]}&{$num}=yes&day={$_GET["day"]}&t={$t}&urisize={$_GET["urisize"]}\"><span>{$ligne}</span></a></li>\n";
}
$t = time();
echo $tpl->_ENGINE_parse_body("\n\t<div id={$t} style='width:97%;font-size:14px;margin-left:10px;margin-right:-15px;margin-top:-5px'>\n\t\t<ul>" . implode("\n", $html) . "</ul>\n\t</div>\n\t\t<script>\n\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\$('#{$t}').tabs();\n\t\t\t\n\t\t\t\n\t\t\t});\n\t\t</script>");
}
示例5: page
function page()
{
$hour_table = date('Ymd') . "_hour";
$q = new mysql_squid_builder();
$defaultday = $q->HIER();
$page = CurrentPageName();
$tpl = new templates();
$webservers = $tpl->_ENGINE_parse_body("{webservers}");
$rule = $tpl->_ENGINE_parse_body("{rule}");
$size = $tpl->_ENGINE_parse_body("{size}");
$time = $tpl->_ENGINE_parse_body("{time}");
$member = $tpl->_ENGINE_parse_body("{member}");
$country = $tpl->_ENGINE_parse_body("{country}");
$url = $tpl->_ENGINE_parse_body("{url}");
$ipaddr = $tpl->_ENGINE_parse_body("{ipaddr}");
$hostname = $tpl->_ENGINE_parse_body("{hostname}");
$title = $tpl->_ENGINE_parse_body("{today}: {requests} {since} " . date("H") . "h");
$change_day = $tpl->_ENGINE_parse_body("{change_day}");
$t = time();
$html = "\n\t<input type='hidden' id='daycache{$t}' value='{$defaultday}'>\n\t<div style='margin:-10px;margin-left:-15px'>\n\t<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:100%'></table>\n\t</div>\n\t\n<script>\n\$(document).ready(function(){\n\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?search=yes&MAC={$_GET["MAC"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$rule}', name : 'hour', width :60, sortable : true, align: 'left'},\n\t\t{display: '{$country}', name : 'country', width : 70, sortable : false, align: 'left'},\n\t\t{display: '{$webservers}', name : 'sitename', width : 282, sortable : true, align: 'left'},\n\t\t{display: '{$size}', name : 'size', width : 73, sortable : true, align: 'left'},\n\t\t{display: 'hits', name : 'hits', width : 60, sortable : true, align: 'left'}\n\n\t\t],\n\t\t\nbuttons : [\n\t\t{name: '{$change_day}', bclass: 'add', onpress : ChangeDay},\n\t\t],\t\t\t\n\t\n\tsearchitems : [\n\t\t{display: '{$webservers}', name : 'sitename'},\n\t\t],\n\tsortname: 'hour',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: 625,\n\theight: 420,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\t\n\t}); \n});\n\n\nfunction ChangeDay(){\n\tYahooWin6('375','{$page}?change-day-popup=yes&t={$t}&MAC={$_GET["MAC"]}','{$change_day}');\n}\n\n</script>\n\t\n\t\n\t";
echo $html;
}
示例6: page
function page()
{
$hour_table = date('Ymd') . "_hour";
$q = new mysql_squid_builder();
$defaultday = $q->HIER();
$page = CurrentPageName();
$tpl = new templates();
$webservers = $tpl->_ENGINE_parse_body("{webservers}");
$hits = $tpl->_ENGINE_parse_body("{hits}");
$size = $tpl->_ENGINE_parse_body("{size}");
$time = $tpl->_ENGINE_parse_body("{day}");
$member = $tpl->_ENGINE_parse_body("{member}");
$country = $tpl->_ENGINE_parse_body("{country}");
$url = $tpl->_ENGINE_parse_body("{url}");
$ipaddr = $tpl->_ENGINE_parse_body("{ipaddr}");
$hostname = $tpl->_ENGINE_parse_body("{hostname}");
$title = $tpl->_ENGINE_parse_body("{today}: {requests} {since} " . date("H") . "h");
$change_day = $tpl->_ENGINE_parse_body("{change_day}");
$this_week = $tpl->javascript_parse_text("{this_week}");
$title = "{$this_week} {$_GET["MAC"]} {$_GET["ipaddr"]}";
$t = time();
$html = "\n\t<input type='hidden' id='daycache{$t}' value='{$defaultday}'>\n\t<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:100%'></table>\n\t\n<script>\n\$(document).ready(function(){\n\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?search=yes&day={$defaultday}&MAC={$_GET["MAC"]}&ipaddr={$_GET["ipaddr"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$time}', name : 'day', width :301, sortable : true, align: 'left'},\n\t\t{display: '{$size}', name : 'size', width : 204, sortable : true, align: 'left'},\n\t\t],\n\t\t\n\t\t\t\n\t\n\tsearchitems : [\n\t\t{display: '{$time}', name : 'day'},\n\t\t],\n\tsortname: 'day',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:18px>{$title}</span>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 420,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\t\n\t}); \n});\n\n\nfunction ChangeDay(){\n\tYahooWin6('375','{$page}?change-day-popup=yes&t={$t}&MAC={$_GET["MAC"]}&ipaddr={$_GET["ipaddr"]}','{$change_day}');\n}\n\n</script>\n\t\n\t\n\t";
echo $html;
}
示例7: events_search
function events_search(){
$page=CurrentPageName();
$tpl=new templates();
$sock=new sockets();
$q=new mysql_squid_builder();
$GLOBALS["Q"]=$q;
$table=date("Ymd")."_hour";
if(!$q->TABLE_EXISTS($table)){
$hierx=strtotime($q->HIER()." 00:00:00");
$table=date("Ymd",$hierx)."_hour";
}
if(isset($_POST['page'])) {$page = $_POST['page'];}
if(isset($_POST['rp'])) {$rp = $_POST['rp'];}
$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));
$total = $ligne["TCOUNT"];
}else{
$total = $q->COUNT_ROWS($table);
}
if(!is_numeric($rp)){$rp=50;}
$pageStart = ($page-1)*$rp;
$limitSql = "LIMIT $pageStart, $rp";
if(isset($_POST["sortname"])){if($_POST["sortname"]<>null){$ORDER="ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";}}
$sql="SELECT * FROM `$table` WHERE 1 $searchstring $ORDER $limitSql";
$results = $q->QUERY_SQL($sql);
if(!$q->ok){json_error_show($q->mysql_error);}
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
$today=date("Y-m-d");
$tcp=new IP();
$cachedT=$tpl->_ENGINE_parse_body("{cached}");
$c=0;
while ($ligne = mysql_fetch_assoc($results)) {
$color="black";
$return_code_text=null;
$ff=array();
$color="black";
$uri=$ligne["sitename"];
$date=$ligne["hour"];
$mac=$ligne["MAC"];
$ip=$ligne["client"];
$user=$ligne["uid"];
$dom=$ligne["familysite"];
if(intval($ligne["size"])>1024){
$size=FormatBytes(intval($ligne["size"])/1024);
}else{
$size="{$ligne["size"]} bytes";
}
if($size=="0 KB"){$size="{$ligne["size"]} bytes";}
$category=$ligne["category"];
//sitename | familysite | client
//| hostname | account | hour | remote_ip | MAC | country | size | hits | uid | category
$ident=array();
$md=md5(serialize($ligne));
$ident[]="<a href=\"javascript:blur()\"
OnClick=\"javascript:Loadjs('squid.nodes.php?node-infos-js=yes&ipaddr=$ip',true);\"
style='text-decoration:underline;color:$color'>$ip</a>";
$spanON="<span style='color:$color'>";
$spanOFF="</span>";
$cached_text=null;
$size=FormatBytes($size/1024);
$return_code_text="<div style='color:$color;font-size:11px'><i>$size</i></div>";
if($user<>null){
$GLOBALS["IPUSERS"][$ip]=$user;
}else{
if(isset($GLOBALS["IPUSERS"][$ip])){
$ident[]="<i>{$GLOBALS["IPUSERS"][$ip]}</i>";
}
}
if($user<>null){
if($tcp->isValid($user)){
$ident[]="<a href=\"javascript:blur()\"
OnClick=\"javascript:Loadjs('squid.nodes.php?node-infos-js=yes&ipaddr=$user',true);\"
style='text-decoration:underline;color:$color'>$user</a>";
//.........这里部分代码省略.........
示例8: nodes_list
function nodes_list()
{
$tpl = new templates();
$MyPage = CurrentPageName();
$q = new mysql_squid_builder();
$defaultday = $q->HIER();
$TableActive = date('Ymd', strtotime($defaultday . " 00:00:00")) . "_hour";
$t = $_GET["t"];
$filterby = $_GET["filterby"];
$search = '%';
$table = "UserAutDB";
$page = 1;
$FORCE_FILTER = null;
$total = 0;
if ($q->COUNT_ROWS($table) == 0) {
json_error_show("No data");
}
$table = "(SELECT {$filterby} FROM {$table} GROUP BY {$filterby} HAVING LENGTH({$filterby})>0) as t";
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 {$FORCE_FILTER} {$searchstring}";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql));
$total = $ligne["TCOUNT"];
} else {
$sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER}";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql));
$total = $ligne["TCOUNT"];
}
if (isset($_POST['rp'])) {
$rp = $_POST['rp'];
}
$pageStart = ($page - 1) * $rp;
$limitSql = "LIMIT {$pageStart}, {$rp}";
$sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}";
$results = $q->QUERY_SQL($sql);
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
if (!$q->ok) {
json_error_show("{$q->mysql_error}");
}
$ipClass = new IP();
while ($ligne = mysql_fetch_assoc($results)) {
$js = null;
$Link = null;
$TextDeco = "none";
$value = utf8_encode($ligne[$filterby]);
$md5 = md5($value);
$valueEnc = urlencode($ligne[$filterby]);
$member = $q->UID_FROM_ALL($ligne[$filterby]);
if ($filterby == "MAC") {
if (!$ipClass->IsvalidMAC($ligne[$filterby])) {
continue;
}
$js = "Loadjs('squid.nodes.php?node-infos-js=yes&MAC={$ligne[$filterby]}',true);";
}
if ($js != null) {
$Link = "OnClick=\"javascript:{$js}\"";
$TextDeco = "underline";
}
$data['rows'][] = array('id' => $md5, 'cell' => array("<a href=\"javascript:blur();\" {$Link} style='font-size:16px;text-decoration:{$TextDeco}'>{$value}</a></span>", "<a href=\"javascript:blur();\" {$Link} style='font-size:16px;text-decoration:{$TextDeco}'>{$member}</a></span>"));
}
echo json_encode($data);
}
示例9: view_table
function view_table(){
$q=new mysql_squid_builder();
$Mypage=CurrentPageName();
$tpl=new templates();
if(!isset($_GET["view-table"])){$_GET["view-table"]=$q->HIER();}
$search='%';
$table=date('Ymd',strtotime($_GET["view-table"]))."_blocked";
$page=1;
$ORDER="ORDER BY zDate DESC";
if($q->COUNT_ROWS($table)==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'];}
if($_POST["query"]<>null){
$_POST["query"]=str_replace("*", "%", $_POST["query"]);
$search=$_POST["query"];
$searchstring="WHERE (`{$_POST["qtype"]}` LIKE '$search')";
$sql="SELECT COUNT(ID) as TCOUNT FROM `$table` $searchstring";
$ligne=mysql_fetch_array($q->QUERY_SQL($sql));
$total = $ligne["TCOUNT"];
}else{
$total = $q->COUNT_ROWS($table);
}
if (isset($_POST['rp'])) {$rp = $_POST['rp'];}
$pageStart = ($page-1)*$rp;
$limitSql = "LIMIT $pageStart, $rp";
$sql="SELECT * FROM `$table` $searchstring $ORDER $limitSql";
writelogs($sql,__FUNCTION__,__FILE__,__LINE__);
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
$results = $q->QUERY_SQL($sql);
while ($ligne = mysql_fetch_assoc($results)) {
$linkZoom="<a href=\"javascript:Loadjs('$Mypage?Zoom-js={$ligne['ID']}&table=$table');\" style='font-size:12px;text-decoration:underline'>";
$data['rows'][] = array(
'id' => $ligne['ID'],
'cell' => array($ligne['zDate'], $linkZoom.$ligne['website']."</a>", $ligne["client"], $ligne['category'],$ligne['rulename'],$ligne['uri'])
);
}
echo json_encode($data);
}
示例10: start6
function start6()
{
$cacheFile = "/usr/share/artica-postfix/ressources/logs/web/INTERFACE_WEBFILTER_BLOCKED.db";
@unlink($cacheFile);
$unix = new unix();
$squid = $unix->LOCATE_SQUID_BIN();
if (!is_file($squid)) {
if ($GLOBALS["VERBOSE"]) {
echo "start6: squid no such binary\n";
}
return;
}
$sock = new sockets();
if ($sock->EnableUfdbGuard() == 0) {
return;
}
$zday = date('Ymd');
$table = $zday . "_blocked";
$q = new mysql_squid_builder();
if (!$q->TABLE_EXISTS($table)) {
$hier = strtotime($q->HIER() . " 00:00:00");
$zday = date('Ymd', $hier);
$table = $zday . "_blocked";
}
if (!$q->TABLE_EXISTS($table)) {
return;
}
$sql = "SELECT COUNT(*) as hits,HOUR(zDate) as `hour` FROM {$table} GROUP BY `hour` ORDER BY `hour`";
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
echo "{$q->mysql_error}";
return;
}
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$hits = $ligne["hits"];
$xdata[] = $ligne["hour"];
$ydata[] = $hits;
}
if (count($xdata) < 2) {
if ($GLOBALS["VERBOSE"]) {
echo "start4(): " . count($xdata) . " < 2\n";
}
return;
}
$array = array($xdata, $ydata);
@file_put_contents($cacheFile, serialize($array));
@chmod($cacheFile, 0755);
}
示例11: nodes_list
function nodes_list()
{
$tpl = new templates();
$MyPage = CurrentPageName();
$q = new mysql_squid_builder();
$defaultday = $q->HIER();
$TableActive = date('Ymd', strtotime($defaultday . " 00:00:00")) . "_hour";
$t = $_GET["t"];
$filterby = $_GET["filterby"];
$fieldname = $_GET["fieldname"];
$search = '%';
$table = "webfilters_nodes";
$page = 1;
$FORCE_FILTER = null;
$total = 0;
if ($q->COUNT_ROWS($table) == 0) {
writelogs("{$table}, no row", __FILE__, __FUNCTION__, __FILE__, __LINE__);
$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'];
}
if ($_POST["query"] != null) {
$_POST["query"] = "*" . $_POST["query"] . "*";
$_POST["query"] = str_replace("**", "*", $_POST["query"]);
$_POST["query"] = str_replace("**", "*", $_POST["query"]);
$_POST["query"] = str_replace("*", "%", $_POST["query"]);
$search = $_POST["query"];
$searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')";
$sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER} {$searchstring}";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql));
$total = $ligne["TCOUNT"];
} else {
$sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER}";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql));
$total = $ligne["TCOUNT"];
}
if (isset($_POST['rp'])) {
$rp = $_POST['rp'];
}
$pageStart = ($page - 1) * $rp;
$limitSql = "LIMIT {$pageStart}, {$rp}";
$sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}";
$results = $q->QUERY_SQL($sql);
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
if (!$q->ok) {
$data['rows'][] = array('id' => $ligne[time() + 1], 'cell' => array($q->mysql_error, "", "", ""));
$data['rows'][] = array('id' => $ligne[time()], 'cell' => array($sql, "", "", ""));
echo json_encode($data);
return;
}
$uptime = $tpl->_ENGINE_parse_body("{uptime}");
$ports = $tpl->_ENGINE_parse_body("{ports}");
if (!isset($_SESSION["PROXY_MAC_ACTIVE"])) {
$results3 = $q->QUERY_SQL("SELECT COUNT(sitename) AS TCOUNT,MAC FROM {$TableActive} GROUP BY MAC");
while ($ligne = mysql_fetch_assoc($results3)) {
$_SESSION["PROXY_MAC_ACTIVE"][$ligne["MAC"]] = true;
}
}
while ($ligne = mysql_fetch_assoc($results)) {
$ID = $ligne["MAC"];
$md5 = md5($ligne["MAC"]);
$ligne["uid"] = utf8_encode($ligne["uid"]);
$enabled = 0;
$textToAdd = null;
$js = "Loadjs('{$MyPage}?node-infos-js=yes&MAC={$ligne["MAC"]}');";
$results2 = $q->QUERY_SQL("SELECT hostname FROM (SELECT hostname FROM UserAutDB WHERE MAC='{$ligne["MAC"]}') as t GROUP BY hostname");
if (!$q->ok) {
$tt[] = $q->mysql_error;
}
$tt = array();
$ArrayNMap = array();
$NMAPS = array();
$ArrayNMap = unserialize(base64_decode($ligne["nmapreport"]));
if (is_array($ArrayNMap)) {
if ($ArrayNMap["OS"] != null) {
$NMAPS[] = "OS:{$ArrayNMap["OS"]}";
}
if ($ArrayNMap["UPTIME"] != null) {
$NMAPS[] = "{$uptime}:{$ArrayNMap["UPTIME"]}";
}
if (count($ArrayNMap["PORTS"]) > 0) {
$NMAPS[] = count($ArrayNMap["PORTS"]) . " {$ports}";
}
if (count($NMAPS) > 0) {
$textToAdd = "<div style='font-size:10px'>" . @implode(" ", $NMAPS) . "</div>";
}
}
//.........这里部分代码省略.........
示例12: webcacheperfs
function webcacheperfs()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$timeF = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$pid = @file_get_contents($pidfile);
if ($pid < 100) {
$pid = null;
}
$unix = new unix();
if ($unix->process_exists($pid)) {
if ($GLOBALS["VERBOSE"]) {
ufdbguard_admin_events("Fatal Already executed pid {$pid}", __FUNCTION__, __FILE__, __LINE__, "stats");
echo "Already executed pid {$pid}\n";
}
return;
}
$prefix = date("Ymd");
$currenttable = "{$prefix}_hour";
$q = new mysql_squid_builder();
$currentHour = date("H");
$currentDay = date('d');
$currentMonth = date('m');
$currentYear = date('Y');
$hierT = strtotime($q->HIER() . " 00:00:00");
$hierDay = date("d", $hierT);
$hierMonth = date("m", $hierT);
$hierYear = date("Y", $hierT);
$Hiertable = date("Ymd", $hierT) . "_hour";
$sql = "SELECT SUM( size ) AS tsize, cached, `HOUR` FROM {$currenttable} GROUP BY cached, `HOUR` HAVING HOUR <{$currentHour} LIMIT 0 , 30";
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
echo $q->mysql_error . "\n";
return;
}
if (mysql_num_rows($results) == 0) {
return;
}
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$HASH[$ligne["HOUR"]][$ligne["cached"]] = $ligne["tsize"];
}
if (!$q->TABLE_EXISTS("webcacheperfs")) {
$q->CheckTables();
}
$prefix = "INSERT IGNORE INTO webcacheperfs (zTimeInt,zHour,zDay,zMonth,zYear,notcached,cached,pourc) VALUES";
while (list($hour, $array) = each($HASH)) {
if (!isset($array[1])) {
$array[1] = 0;
}
$zTimeInt = "{$hour}{$currentDay}{$currentMonth}{$currentYear}";
if ($array[1] == 0) {
ufdbguard_admin_events("Today {$hour}h 0% cache performance...", __FUNCTION__, __FILE__, __LINE__, "stats");
$sqlQuery = "{$prefix} ('{$zTimeInt}','{$hour}','{$currentDay}','{$currentMonth}','{$currentYear}','{$array[0]}',0,0)";
$q->QUERY_SQL($sqlQuery);
if (!$q->ok) {
ufdbguard_admin_events("Fatal: {$q->mysql_error}\n{$sqlQuery}", __FUNCTION__, __FILE__, __LINE__, "stats");
return;
}
continue;
}
$sum = $array[1] + $array[0];
$p1 = $array[1] / $sum;
$p1 = round($p1 * 100);
ufdbguard_admin_events("Today {$hour}h {$p1}% cache performance...", __FUNCTION__, __FILE__, __LINE__, "stats");
$sqlQuery = "{$prefix} ({$zTimeInt},{$hour},{$currentDay},{$currentMonth},{$currentYear},{$array[0]},{$array[1]},'{$p1}')";
$q->QUERY_SQL($sqlQuery);
if (!$q->ok) {
ufdbguard_admin_events("Fatal: {$q->mysql_error}\n{$sqlQuery}", __FUNCTION__, __FILE__, __LINE__, "stats");
return;
}
}
unset($HASH);
$sql = "SELECT SUM( size ) AS tsize, cached, `HOUR` FROM {$Hiertable} GROUP BY cached, `HOUR` LIMIT 0 , 30";
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
echo $q->mysql_error . "\n";
return;
}
if (mysql_num_rows($results) == 0) {
return;
}
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$HASH[$ligne["HOUR"]][$ligne["cached"]] = $ligne["tsize"];
}
while (list($hour, $array) = each($HASH)) {
if (!isset($array[1])) {
$array[1] = 0;
}
$zTimeInt = "{$hour}{$currentDay}{$currentMonth}{$currentYear}";
if ($array[1] == 0) {
$q->QUERY_SQL("{$prefix} ({$zTimeInt},{$hour},{$hierDay},{$hierMonth},{$hierYear},{$array[0]},0,0)");
if (!$q->ok) {
ufdbguard_admin_events("Fatal: {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "stats");
return;
}
continue;
}
$sum = $array[1] + $array[0];
$p1 = $array[1] / $sum;
$p1 = round($p1 * 100);
//.........这里部分代码省略.........
示例13: graph_web_sites
function graph_web_sites(){
if($GLOBALS["VERBOSE"]){echo __FUNCTION__."<br>\n";}
$q=new mysql_squid_builder();
$page=CurrentPageName();
$tpl=new templates();
if(!isset($_GET["day"])){$_GET["day"]=$q->HIER();}
if(!isset($_GET["type"])){$_GET["type"]="size";}
if($_GET["type"]==null){$_GET["type"]="size";}
$type=$_GET["type"];
$field_query="size";
$today=date("Y-m-d");
if($_GET["day"]==$today){$_GET["day"]=$q->HIER();}
if($type=="req"){$field_query="hits";}
$hour_table=date('Ymd',strtotime($_GET["day"]))."_hour";
$sourcetable="dansguardian_events_".date('Ymd',strtotime($_GET["day"]));
$sql="SELECT SUM($field_query) as totalsize,familysite FROM $hour_table GROUP BY familysite ORDER BY totalsize DESC LIMIT 0,10";
$results=$q->QUERY_SQL($sql);
$data=array();
while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
if(trim($ligne["familysite"])==null){continue;}
$familysite=$ligne["familysite"];
if($_GET["type"]=="size"){$size=round(($ligne["totalsize"]/1024));
$size_text=FormatBytes(($ligne["totalsize"]/1024));
}else{$size=$ligne["totalsize"];$size_text=$size;}
if($_GET["type"]=="size"){$tsize=round(($ligne["totalsize"]/1024));}else{$tsize=$ligne["totalsize"];}
$data[$familysite]=$tsize;
}
$highcharts=new highcharts();
$highcharts->container=$_GET["container"];
$highcharts->PieDatas=$data;
$highcharts->ChartType="pie";
$highcharts->PiePlotTitle="{websites}";
$highcharts->Title="{top} {websites} ({$GLOBALS["title_array"][$type]})";
echo $highcharts->BuildChart();
}
示例14: gencache_TOP
function gencache_TOP()
{
$file = "/usr/share/artica-postfix/ressources/logs/web/TOP_CACHED.db";
@unlink($file1);
@unlink($file2);
$q = new mysql_squid_builder();
$current_table = date("Ymd") . "_gcache";
if (!$q->TABLE_EXISTS($current_table)) {
$xtime = strtotime($q->HIER() . " 00:00:00");
$current_table = date("Ymd", $xtime) . "_gcache";
}
if (!$q->TABLE_EXISTS($current_table)) {
if ($GLOBALS["VERBOSE"]) {
echo "{$current_table} no such table...\n";
}
return;
}
$sql = "SELECT familysite,cached,SUM(size) as size FROM\n\t{$current_table} GROUP BY cached,familysite HAVING cached=1 ORDER BY `size` DESC LIMIT 0,10";
$results = $q->QUERY_SQL($sql);
$Count = mysql_num_rows($results);
if ($GLOBALS["VERBOSE"]) {
echo $sql . "\n{$Count} items \n";
}
if ($Count < 2) {
return;
}
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$size = $ligne["size"];
$size = $size / 1024;
$size = $size / 1024;
$size = round($size);
$ARRAY[$ligne["familysite"]] = $size;
}
@file_put_contents($file1, serialize($ARRAY));
@chmod($file1, 0755);
$ARRAY = array();
$sql = "SELECT familysite,cached,SUM(size) as size FROM\n\t{$current_table} GROUP BY cached,familysite HAVING cached=0 ORDER BY `size` DESC LIMIT 0,10";
$results = $q->QUERY_SQL($sql);
$Count = mysql_num_rows($results);
if ($GLOBALS["VERBOSE"]) {
echo $sql . "\n{$Count} items \n";
}
if ($Count < 2) {
return;
}
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$size = $ligne["size"];
$size = $size / 1024;
$size = $size / 1024;
$size = round($size);
$ARRAY[$ligne["familysite"]] = $size;
}
@file_put_contents($file2, serialize($ARRAY));
@chmod($file2, 0755);
$ARRAY = array();
}
示例15: squidhour_tables_rows
function squidhour_tables_rows(){
$q=new mysql_squid_builder();
$Mypage=CurrentPageName();
$tpl=new templates();
if(!isset($_GET["view-table"])){$_GET["view-table"]=$q->HIER();}
$search='%';
$time=strtotime("{$_GET["day"]} 00:00:00");
$table="(SELECT table_name as c FROM information_schema.tables WHERE
table_schema = 'squidlogs' AND table_name LIKE 'squidhour_%') as t";
$page=1;
$ORDER="ORDER BY zDate DESC";
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));
$total = $ligne["TCOUNT"];
}else{
$sql="SELECT COUNT(*) as TCOUNT FROM $table";
$ligne=mysql_fetch_array($q->QUERY_SQL($sql));
$total = $ligne["TCOUNT"];
}
if (isset($_POST['rp'])) {$rp = $_POST['rp'];}
$pageStart = ($page-1)*$rp;
$limitSql = "LIMIT $pageStart, $rp";
$sql="SELECT * FROM $table WHERE 1 $searchstring $ORDER $limitSql";
$data = array();
$data['page'] = $page;
$data['total'] = $total;
$data['rows'] = array();
$results = $q->QUERY_SQL($sql);
if(!$q->ok){json_error_show($q->mysql_error."\n$sql");}
while ($ligne = mysql_fetch_assoc($results)) {
$linkZoom="<a href=\"javascript:Loadjs('squid.blocked.statistics.days.php?Zoom-js={$ligne['zMD5']}&ID={$ligne['zMD5']}&table=$table&key=zMD5');\" style='font-size:12px;text-decoration:underline'>";
$table=$ligne["c"];
$time=$q->TIME_FROM_HOUR_TEMP_TABLE($table);
$date=date("Y-m-d H:i:s",$time);
$sum=$q->COUNT_ROWS($table);
$sum=FormatNumber($sum);
$data['rows'][] = array(
'id' => $table,
'cell' => array($date,$table,$sum,'')
);
}
echo json_encode($data);
}