function graph2() { $q = new mysql_squid_builder(); $tpl = new templates(); $uidtable = $q->uid_to_tablename($_GET["member-value"]); $sql = "SELECT SUM(size) as size,zDate,familysite FROM `www_{$uidtable}` GROUP BY\n\tfamilysite,zDate HAVING familysite='{$_GET["familysite"]}' ORDER BY zDate"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error); } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["size"]; $size = $size / 1024; $size = $size / 1024; $size = round($size, 2); $date = strtotime($ligne["zDate"] . "00:00:00"); $xdata[] = date("m-d", $date); $ydata[] = $size; } $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->xAxis = $xdata; $highcharts->Title = "{$_GET["familysite"]} {size} (MB)"; $highcharts->yAxisTtitle = "{size}"; $highcharts->xAxisTtitle = "{days}"; $highcharts->datas = array("{requests}" => $ydata); echo $highcharts->BuildChart(); }
function graph4() { $q = new mysql_squid_builder(); $tpl = new templates(); $xtime = $_GET["xtime"]; $hourtable = date("Ymd", $xtime) . "_hour"; $sql = "SELECT SUM(size) as size,`hour`,uid,category FROM {$hourtable} GROUP BY\n\tcategory,`hour`,uid HAVING `hour`='{$_GET["hour"]}' AND uid='{$_GET["uid"]}' ORDER BY `size` DESC LIMIT 0,15"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error); } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["size"]; $size = $size / 1024; $size = $size / 1024; $size = round($size, 2); $PieData[$ligne["category"]] = $size; } if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{top_websites} {size} (MB) {$_GET["hour"]}h"; $highcharts->Title = $tpl->_ENGINE_parse_body("{top_categories}/{size} {$_GET["hour"]}h"); echo $highcharts->BuildChart(); }
function graph5() { $q = new mysql_squid_builder(); $tpl = new templates(); $sql = "SELECT SUM( size ) AS size, familysite\nFROM `visited_sites_days`\nGROUP BY familysite ORDER BY size DESC LIMIT 0,10"; $results = $q->QUERY_SQL($sql); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = round($ligne["size"] / 1024 / 1000); $PieData[$ligne["familysite"]] = $size; } if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{websites}"; $highcharts->Title = $tpl->_ENGINE_parse_body("{top_websites}/{size}"); echo $highcharts->BuildChart(); }
function graph3() { $q = new mysql_squid_builder(); $tpl = new templates(); $sql = "SELECT SUM( hits ) AS size, uid\nFROM `members_uid`\nGROUP BY uid HAVING uid NOT LIKE '%\$' AND LENGTH(uid) >0 ORDER BY size DESC LIMIT 0,10"; $results = $q->QUERY_SQL($sql); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["size"]; $PieData[$ligne["uid"]] = $size; } if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{hits}"; $highcharts->Title = $tpl->_ENGINE_parse_body("{top_members}/{hits}"); echo $highcharts->BuildChart(); }
function graph5() { $q = new mysql_squid_builder(); $page = CurrentPageName(); $tpl = new templates(); $t = $_GET["t"]; $ff = time(); $tablename = date("Ymd", $_GET["xtime"]) . "_hour"; $category = mysql_escape_string2($_GET["category"]); $sql = "SELECT SUM(size) as thits, category,uid FROM `{$tablename}`\n\tGROUP BY category,uid \n\tHAVING category='{$category}'\n\tORDER BY thits DESC LIMIT 0,10"; $unknown = $tpl->_ENGINE_parse_body("{unknown}"); $c = 0; $results = $q->QUERY_SQL($sql); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { if (trim($ligne["uid"]) == null) { $ligne["uid"] = $unknown; } $ligne["thits"] = round($ligne["thits"] / 1024 / 1000); $PieData[$ligne["uid"]] = $ligne["thits"]; $c++; } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{hits}"; $highcharts->Title = $tpl->_ENGINE_parse_body("{$category}: {top_members_by_size} (MB)"); echo $highcharts->BuildChart(); }
function graph1() { $q = new mysql_squid_builder(); $page = CurrentPageName(); $tpl = new templates(); $t = $_GET["t"]; $ff = time(); $tablename = $_GET["tablename"]; if (is_numeric($_GET["xtime"])) { $tablename = date("Ymd", $_GET["xtime"]) . "_hour"; } $sql = "SELECT SUM(hits) as thits, `hour` FROM {$tablename} GROUP BY `hour` ORDER BY `hour`"; $c = 0; $results = $q->QUERY_SQL($sql); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } if (mysql_num_rows($results) > 0) { $nb_events = mysql_num_rows($results); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $xdata[] = $ligne["hour"]; $ydata[] = $ligne["thits"]; $c++; } } $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->xAxis = $xdata; $highcharts->Title = "{hits}/{hour}"; $highcharts->yAxisTtitle = "{hits}"; $highcharts->xAxisTtitle = "{hours}"; $highcharts->datas = array("{hits}" => $ydata); echo $highcharts->BuildChart(); }
function graph9() { $tpl = new templates(); $unknown = $tpl->_ENGINE_parse_body("{unknown}"); $q = new mysql_squid_builder(); $tpl = new templates(); $uidtable = $q->uid_to_tablename($_GET["member-value"]); $sql = "SELECT SUM(hits) as hits,sitename FROM `blocked_{$uidtable}` GROUP BY\n\tsitename ORDER BY hits DESC LIMIT 0,15"; $results = $q->QUERY_SQL($sql); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["hits"]; if (trim($ligne["sitename"]) == null) { $ligne["sitename"] = $unknown; } $PieData[$ligne["sitename"]] = $size; } if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{hits}"; $highcharts->Title = $tpl->_ENGINE_parse_body("{blocked}/{top_websites}/{hits}"); echo $highcharts->BuildChart(); }
function graph4() { $q = new mysql_squid_builder(); $tpl = new templates(); $tablename = "www_" . $q->uid_to_tablename($_GET["uid"]); $sql = "SELECT SUM(hits) as hits,familysite,category FROM `{$tablename}` GROUP BY familysite,category\n\tHAVING `category`='{$_GET["category"]}'\n\tORDER BY hits DESC LIMIT 0,15"; if ($_GET["category"] == null) { $sql = "SELECT SUM(hits) as hits,familysite,category FROM `{$tablename}` GROUP BY familysite,category\n\t\tHAVING `category` IS NULL\n\t\tORDER BY hits DESC LIMIT 0,15"; } $results = $q->QUERY_SQL($sql); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["hits"]; $PieData[$ligne["familysite"]] = $size; } if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{hits}"; $highcharts->Title = $tpl->_ENGINE_parse_body("{$_GET["category"]}/{top_websites}/{size}"); echo $highcharts->BuildChart(); }
function history_month_graph1() { $q = new mysql_squid_builder(); $tpl = new templates(); $xtime = $_GET["xtime"]; $month_table = $_GET["table"]; $sql = "SELECT `day` as tday,SUM(size) as QuerySize FROM\n\t`{$month_table}` WHERE `{$_GET["field"]}`='{$_GET["value"]}'\n\tGROUP BY tday ORDER BY tday"; $fieldgroup = "day"; $x_title = "{days}"; $maintitle = "downloaded_size_per_day"; $maintitle2 = "requests_per_day"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error); } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = round($ligne["QuerySize"] / 1024 / 1000); $xdata[] = $ligne["day"]; $ydata[] = $size; } $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->xAxis = $xdata; $highcharts->Title = "{downloaded_size_per_day} (MB)"; $highcharts->yAxisTtitle = "{size} (MB)"; $highcharts->LegendSuffix = " MB"; $highcharts->xAxisTtitle = "{days}"; $highcharts->datas = array("{size}" => $ydata); echo $highcharts->BuildChart(); }
function graph2(){ $tpl=new templates(); $page=CurrentPageName(); $t=time(); $CurTime=date("YmdH"); $CurDay=date("Ymd"); $q=new mysql(); $sock=new sockets(); $hostname=$hostname=$sock->GET_INFO("myhostname"); if($hostname==null){$hostname=$sock->getFrameWork("system.php?hostname-g=yes");$sock->SET_INFO($hostname,"myhostname");} $title="$hostname: %{cpu} {yesterday}"; $timetext="{hour}"; $sql="SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate,hostname, HOUR(zDate) as `time`,AVG(cpu) as value FROM `cpustats` GROUP BY `time` ,tdate,hostname HAVING tdate=DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d') AND `hostname`='$hostname' ORDER BY `time`"; $results=$q->QUERY_SQL($sql,"artica_events"); if(!$q->ok){$tpl->javascript_senderror($q->mysql_error,$_GET["container"]);} while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){ $xdata[]=$ligne["time"]; $ydata[]=$ligne["value"]; } $highcharts=new highcharts(); $highcharts->container=$_GET["container"]; $highcharts->xAxis=$xdata; $highcharts->Title=$title; $highcharts->TitleFontSize="14px"; $highcharts->AxisFontsize="12px"; $highcharts->yAxisTtitle=" {cpu} % "; $highcharts->xAxis_labels=true; $highcharts->LegendPrefix=$tpl->_ENGINE_parse_body("{cpu} "); $highcharts->LegendSuffix="%"; $highcharts->xAxisTtitle=$timetext; $highcharts->datas=array("{%}"=>$ydata); echo $highcharts->BuildChart(); }
function graph2() { $tpl = new templates(); $unknown = $tpl->_ENGINE_parse_body("{unknown}"); $q = new mysql_squid_builder(); $tpl = new templates(); $_GET["uid"] = mysql_escape_string2($_GET["uid"]); $sql = "SELECT SUM(hits) as hits,category,zDate,uid FROM `youtube_all` GROUP BY\n\tcategory,zDate,uid HAVING zDate='" . date("Y-m-d", $_GET["xtime"]) . "' AND uid='{$_GET["uid"]}' ORDER BY hits DESC LIMIT 0,15"; $results = $q->QUERY_SQL($sql); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["hits"]; if (trim($ligne["category"]) == null) { $ligne["category"] = $unknown; } $PieData[$ligne["category"]] = $size; } if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error . "<br>{$sql}", $_GET["container"]); } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{categories}"; $highcharts->Title = $tpl->_ENGINE_parse_body("{top_categories}/{hits}"); echo $highcharts->BuildChart(); }
function generate_graph() { $q = new mysql_squid_builder(); $page = CurrentPageName(); $tpl = new templates(); $t = $_GET["t"]; $ff = time(); $xtime = $_GET["xtime"]; $tablename = "youtubeday_" . date("Ymd", $xtime); $sql = "SELECT SUM(hits) as thits, hour FROM {$tablename} GROUP BY hour ORDER BY hour"; $c = 0; $results = $q->QUERY_SQL($sql); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error . "<br>{$sql}", $_GET["container"]); } if (mysql_num_rows($results) > 0) { $nb_events = mysql_num_rows($results); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $xdata[] = $ligne["hour"]; $ydata[] = $ligne["thits"]; $c++; } $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->xAxis = $xdata; $highcharts->Title = "Youtube: {statistics} " . $tpl->_ENGINE_parse_body("{hits}/{hours}"); $highcharts->yAxisTtitle = "{requests}"; $highcharts->xAxisTtitle = "{hours}"; $highcharts->datas = array("{requests}" => $ydata); echo $highcharts->BuildChart(); } }
function graph5() { $q = new mysql_squid_builder(); $tpl = new templates(); $hourtable = date("Ymd", $_GET["xtime"]) . "_hour"; $sql = "SELECT SUM(size) as size,`familysite`,MAC FROM {$hourtable} GROUP BY MAC,`familysite` HAVING MAC='{$_GET["MAC"]}' ORDER BY hits DESC LIMIT 0,15"; $results = $q->QUERY_SQL($sql); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["size"]; $size = $size / 1024; $size = $size / 1024; $size = round($size, 2); $PieData[$ligne["familysite"]] = $size; } if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{size} (MB)"; $highcharts->Title = $tpl->_ENGINE_parse_body("{top_websites}/{size}"); echo $highcharts->BuildChart(); }
function graph2() { $q = new mysql_squid_builder(); $tpl = new templates(); $xtime = $_GET["xtime"]; $hourtable = date("Ymd", $xtime) . "_hour"; $sql = "SELECT SUM(size) as size,`hour`,uid,familysite FROM {$hourtable} GROUP BY\n\tfamilysite,`hour`,uid HAVING familysite='{$_GET["familysite"]}' AND uid='{$_GET["uid"]}' ORDER BY `hour`"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error); } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["size"]; $size = $size / 1024; $size = $size / 1024; $size = round($size, 2); $xdata[] = $ligne["hour"]; $ydata[] = $size; } $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->xAxis = $xdata; $highcharts->Title = "{$_GET["familysite"]} {size}/{hour} (MB)"; $highcharts->yAxisTtitle = "{size}"; $highcharts->xAxisTtitle = "{hours}"; $highcharts->datas = array("{size}" => $ydata); echo $highcharts->BuildChart(); }
function section_topou_graph1() { $q = new mysql_squid_builder(); $tpl = new templates(); $year = $_GET["year"]; $month = $_GET["month"]; $table = "quotamonth_{$year}{$month}"; $sql = "SELECT `ou`,SUM(size) as `size` FROM {$table} GROUP BY `ou`\n\tORDER BY `size` DESC LIMIT 0,20 "; $results = $q->QUERY_SQL($sql); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["size"]; $size = $size / 1024; $size = $size / 1024; $size = round($size); if ($ligne["ou"] == null) { $ligne["ou"] = "unknown"; } $PieData[$ligne["ou"]] = $size; } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{size} MB"; $highcharts->Title = $tpl->_ENGINE_parse_body("{top_ou} {size} MB"); echo $highcharts->BuildChart(); }
function graph3() { $q = new mysql_squid_builder(); $page = CurrentPageName(); $tpl = new templates(); $t = $_GET["t"]; $ff = time(); $tablename = date("Ymd", $_GET["xtime"]) . "_blocked"; $sql = "SELECT COUNT(ID) as thits, uid FROM `{$tablename}`\n\tGROUP BY uid\n\tORDER BY thits DESC LIMIT 0,10"; $c = 0; $results = $q->QUERY_SQL($sql); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $PieData[$ligne["uid"]] = $ligne["thits"]; $c++; } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{hits}"; $highcharts->Title = $tpl->_ENGINE_parse_body("{top_members_by_hits} ({uid})"); echo $highcharts->BuildChart(); }
function graph6() { $tpl = new templates(); $page = CurrentPageName(); $t = time(); $CurTime = date("YmdH"); $CurDay = date("Ymd"); $q = new mysql_squid_builder(); $hour_table = "quotahours_{$CurTime}"; $day_table = "quotaday_{$CurDay}"; $title = "{top_members} {downloaded_size_this_day} (MB)"; $timetext = "{hour}"; $sql = "SELECT SUM(size) as tsize,ipaddr,uid,MAC FROM {$day_table} GROUP BY ipaddr,uid,MAC LIMIT 0,15"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ipaddr = $ligne["ipaddr"]; $uid = $ligne["uid"]; $MAC = $ligne["MAC"]; $size = $ligne["tsize"]; if ($uid != null) { $MEMBERS[$uid] = $MEMBERS[$uid] + $size; continue; } if ($MAC != null) { $MEMBERS[$MAC] = $MEMBERS[$MAC] + $size; continue; } if ($ipaddr != null) { $MEMBERS[$ipaddr] = $MEMBERS[$ipaddr] + $size; continue; } } while (list($member, $size) = each($MEMBERS)) { $size = $size / 1024; $size = $size / 1024; $PieData[$member] = $size; } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->TitleFontSize = "14px"; $highcharts->AxisFontsize = "12px"; $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{size} MB"; $highcharts->Title = $tpl->_ENGINE_parse_body($title); echo $highcharts->BuildChart(); }
function section_topuser_graph1() { $q = new mysql_squid_builder(); $tpl = new templates(); $year = $_GET["year"]; $month = $_GET["month"]; $table = "quotamonth_{$year}{$month}"; $page = CurrentPageName(); $familysite = mysql_escape_string2($_GET["familysite"]); $sql = "SELECT `familysite`,SUM(size) as `size`,uid FROM {$table} GROUP BY `familysite`,uid\n\tHAVING familysite='{$familysite}' ORDER BY `size` DESC LIMIT 0,50"; $results = $q->QUERY_SQL($sql); $suffix = suffix(); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["size"]; $size = $size / 1024; $size = $size / 1024; $size = round($size); $PieData[$ligne["uid"]] = $size; } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{size} MB"; $highcharts->Title = $tpl->_ENGINE_parse_body("{$_GET["familysite"]}: {top_users} {size} MB"); $highcharts->subtitle = "<a href=\"javascript:Loadjs('{$page}?topmembers-table-js=yes{$suffix}')\" style='text-decoration:underline;font-size:18px'>{more_details}</a>"; echo $highcharts->BuildChart(); }
function section_flow_graph1() { $q = new mysql_squid_builder(); $tpl = new templates(); $year = $_GET["year"]; $month = $_GET["month"]; $table = "quotamonth_{$year}{$month}"; $sql = "SELECT `day`,uid,familysite,SUM(size) as `size` FROM {$table} GROUP BY `day`,uid,familysite\n\tHAVING uid='{$_GET["uid"]}' AND `familysite`='{$_GET["familysite"]}' ORDER BY `day`"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["size"]; $size = $size / 1024; $size = $size / 1024; $size = round($size); $date = $ligne["day"]; $xdata[] = $date; $ydata[] = $size; } $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->xAxis = $xdata; $highcharts->Title = "{$_GET["uid"]} {website} {$_GET["familysite"]}: {flow} (MB)"; $highcharts->yAxisTtitle = "{size} MB"; $highcharts->xAxisTtitle = "{days}"; $highcharts->LegendSuffix = "MB"; $highcharts->datas = array("{flow}" => $ydata); echo $highcharts->BuildChart(); }
function graph3() { $tpl = new templates(); $unknown = $tpl->_ENGINE_parse_body("{unknown}"); $q = new mysql_squid_builder(); $tpl = new templates(); $youtube = new YoutubeStats(); $sql = "SELECT SUM(hits) as hits,uid FROM `youtube_all` GROUP BY\n\tuid ORDER BY hits DESC LIMIT 0,15"; $results = $q->QUERY_SQL($sql); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = $ligne["hits"]; $title = $ligne["uid"]; if ($title == null) { $title = $unknown; } if (strlen($title) > 20) { $title = substr($title, 0, 17) . "..."; } $PieData[$title] = $size; } if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } $tpl = new templates(); $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->PieDatas = $PieData; $highcharts->ChartType = "pie"; $highcharts->PiePlotTitle = "{members}"; $highcharts->Title = $tpl->_ENGINE_parse_body("{top_members}/{hits}"); echo $highcharts->BuildChart(); }
function graph2() { $tpl = new templates(); if ($_GET["time"] == "hour") { $sql = "SELECT DATE_FORMAT( zDate, '%Y-%m-%d %H' ) AS tdate, MINUTE( zDate ) AS time, AVG( memory_used ) AS value\n\t\t\t\tFROM `sys_mem`\n\t\t\t\tGROUP BY `time` , tdate\n\t\t\t\tHAVING tdate = DATE_FORMAT( NOW( ) , '%Y-%m-%d %H' )\n\t\t\t\tORDER BY `time`"; $title = "{memory_consumption_this_hour}"; $timetext = "{minutes}"; } if ($_GET["time"] == "day") { $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate,\n\t\tHOUR(zDate) as time,AVG(memory_used) as value FROM `sys_mem` GROUP BY `time`,tdate\n\t\tHAVING tdate=DATE_FORMAT(NOW(),'%Y-%m-%d') ORDER BY `time`"; $title = "{memory_consumption_today}"; $timetext = "{hours}"; } if ($_GET["time"] == "week") { $sql = "SELECT WEEK(zDate) as tdate,\n\t\tDAY(zDate) as `time`,AVG(memory_used) as value FROM `sys_mem` GROUP BY time,tdate\n\t\tHAVING tdate=WEEK(NOW()) ORDER BY `time`"; $title = "{memory_consumption_this_week}"; $timetext = "{days}"; } $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { $tpl->javascript_senderror($q->mysql_error, $_GET["container"]); } if (mysql_num_rows($results) < 2) { $tpl->javascript_senderror("{this_request_contains_no_data}: (" . mysql_num_rows($results) . ")", $_GET["container"]); } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $xdata[] = $ligne["time"]; $ligne["value"] = $ligne["value"] / 1024; $ydata[] = round($ligne["value"], 2); } $highcharts = new highcharts(); $highcharts->container = $_GET["container"]; $highcharts->xAxis = $xdata; $highcharts->Title = $title; $highcharts->yAxisTtitle = "{memory} (MB)"; $highcharts->xAxisTtitle = $timetext; $highcharts->datas = array("{memory}" => $ydata); echo $highcharts->BuildChart(); }