本文整理汇总了PHP中mysql_squid_builder::WEEK_TOTIMEHASH_FROM_TABLENAME方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql_squid_builder::WEEK_TOTIMEHASH_FROM_TABLENAME方法的具体用法?PHP mysql_squid_builder::WEEK_TOTIMEHASH_FROM_TABLENAME怎么用?PHP mysql_squid_builder::WEEK_TOTIMEHASH_FROM_TABLENAME使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql_squid_builder
的用法示例。
在下文中一共展示了mysql_squid_builder::WEEK_TOTIMEHASH_FROM_TABLENAME方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page
function page()
{
$page = CurrentPageName();
$tpl = new templates();
$week = $_GET["week"];
$year = $_GET["year"];
$familysite = $_GET["familysite"];
$t = time();
$tablename = "{$year}{$week}_week";
$sql = "SELECT `day`,SUM(hits) as hits,SUM(size) as size FROM {$tablename} GROUP BY `day`,familysite HAVING familysite='{$familysite}'";
$q = new mysql_squid_builder();
$timeZ = $q->WEEK_TOTIMEHASH_FROM_TABLENAME($tablename);
$results = $q->QUERY_SQL($sql);
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$xdata[] = $tpl->_ENGINE_parse_body(date("{l}", $timeZ[$ligne["day"]]));
$ydata[] = $ligne["hits"];
$ydata2[] = round($ligne["size"] / 1024 / 1000);
}
$targetedfile = "ressources/logs/" . md5(basename(__FILE__) . "." . __FUNCTION__ . "." . $sql) . ".6.png";
$gp = new artica_graphs();
$gp->width = 938;
$gp->height = 250;
$gp->filename = "{$targetedfile}";
$gp->xdata = $xdata;
$gp->ydata = $ydata;
$gp->y_title = null;
$gp->x_title = $tpl->_ENGINE_parse_body("{days}");
$gp->title = null;
$gp->margin0 = true;
$gp->Fillcolor = "blue@0.9";
$gp->color = "146497";
$t = time();
$gp->line_green();
if (is_file($targetedfile)) {
$image = "<center>\n\t<p style='font-size:18px'>{$familysite}: {requests_during_this_week}</p>\n\t<img src='{$targetedfile}'></center>";
}
reset($xdata);
$targetedfile = "ressources/logs/" . md5(basename(__FILE__) . "." . __FUNCTION__ . "." . $sql) . ".7.png";
$gp = new artica_graphs();
$gp->width = 938;
$gp->height = 250;
$gp->filename = "{$targetedfile}";
$gp->xdata = $xdata;
$gp->ydata = $ydata2;
$gp->y_title = null;
$gp->x_title = $tpl->_ENGINE_parse_body("{days}");
$gp->title = null;
$gp->margin0 = true;
$gp->Fillcolor = "blue@0.9";
$gp->color = "146497";
$t = time();
$gp->line_green();
if (is_file($targetedfile)) {
$image2 = "<center>\n\t<p style='font-size:18px'>{$familysite}: {size_during_this_week} (MB)</p>\n\t<img src='{$targetedfile}'></center>";
}
$html = "\n\t{$image}\n\t{$image2}\n\t<hr>\n\t<div id='{$t}'></div>\n\t<script>\n\t\tLoadAjax('{$t}','{$page}?sites-tables=yes&familysite={$familysite}&week={$_GET["week"]}&year={$_GET["year"]}');\n\t</script>\n\t";
echo $html;
}
示例2: generate_graph
function generate_graph()
{
include_once 'ressources/class.artica.graphs.inc';
$q = new mysql_squid_builder();
$page = CurrentPageName();
$tpl = new templates();
$t = $_GET["t"];
$ff = time();
$year = $_GET["year"];
$week = $_GET["week"];
$tablename_prod = "{$year}{$week}_blocked_week";
$WEEKZ = $q->WEEK_TOTIMEHASH_FROM_TABLENAME($tablename_prod);
$sql = "SELECT SUM(hits) as tcount,`day` FROM {$tablename_prod} GROUP BY `day` ORDER BY `day`";
$c = 0;
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
}
if (mysql_num_rows($results) > 0) {
$nb_events = mysql_num_rows($results);
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$xdata[] = $tpl->_ENGINE_parse_body(date("{l}", $WEEKZ[$ligne["day"]]));
$ydata[] = $ligne["tcount"];
$c++;
}
$t = time();
$targetedfile = "ressources/logs/" . md5(basename(__FILE__) . "." . __FUNCTION__ . ".day.{$tablename}") . ".png";
$gp = new artica_graphs();
$gp->width = 920;
$gp->height = 350;
$gp->filename = "{$targetedfile}";
$gp->xdata = $xdata;
$gp->ydata = $ydata;
$gp->y_title = null;
$gp->x_title = $tpl->_ENGINE_parse_body("{days}");
$gp->title = null;
$gp->margin0 = true;
$gp->Fillcolor = "blue@0.9";
$gp->color = "146497";
$gp->line_green();
if (is_file($targetedfile)) {
echo "<center>\n\t\t\t<div style='font-size:18px;margin-bottom:10px'>" . $tpl->_ENGINE_parse_body("{blocked}/{day}") . "</div>\n\t\t\t<img src='{$targetedfile}'></center>";
}
}
}
示例3: logsuris_week
function logsuris_week()
{
$tpl = new templates();
$page = CurrentPageName();
$q = new mysql_squid_builder();
$week = $_GET["week"];
$year = $_GET["year"];
if (!is_numeric($year)) {
$year = date('Y');
}
$table = "{$year}{$week}_week";
$title = $q->WEEK_TITLE($week, $year);
$time = $q->WEEK_TIME_FROM_TABLENAME($table);
$month = date("m", $time);
$sql = "SELECT sitename,`day` ,SUM(hits) AS hits,SUM(size) as size FROM \t{$table} \n\tGROUP BY sitename,`day` HAVING sitename='{$_GET["www"]}' ORDER BY `day`";
$results = $q->QUERY_SQL($sql);
if (mysql_num_rows($results) > 1) {
if (!$q->ok) {
echo $q->mysql_error;
}
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$xdata[] = $ligne["day"];
$ydata[] = $ligne["hits"];
}
$targetedfile = "ressources/logs/" . md5(basename(__FILE__) . "." . __FUNCTION__) . ".{$_GET["www"]}.hits.png";
$gp = new artica_graphs();
$gp->width = 550;
$gp->height = 220;
$gp->filename = "{$targetedfile}";
$gp->xdata = $xdata;
$gp->ydata = $ydata;
$gp->y_title = null;
$gp->x_title = $tpl->_ENGINE_parse_body("{hours}");
$gp->title = null;
$gp->margin0 = true;
$gp->Fillcolor = "blue@0.9";
$gp->color = "146497";
$gp->line_green();
$image = "<center style='margin-top:5px'><img src='{$targetedfile}'></center>";
} else {
$ligne = mysql_fetch_array($results);
$ligne["size"] = FormatBytes($ligne["size"] / 1024);
if (strlen($ligne["day"]) == 1) {
$ligne["day"] = "0{$ligne["day"]}";
}
$image = "<div style='font-size:14px;margin:5px'>{$ligne["day"]}, {$ligne["hits"]} {requests} {$ligne["size"]}</div>";
}
$html = "\n\t\n{$image}\n<div style='font-size:14px'>{$title}</div>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t<th>{date} </th>\n\t<th>{client}</th>\n\t<th>{sitename}</th>\n\t<th>{hits}</th>\n\t<th>{size}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
$sql = "SELECT client,hostname,MAC,uid,sitename,`day` as zDate,`size` as QuerySize,hits FROM {$table} WHERE sitename='{$_GET["www"]}' ORDER BY `day` asc";
$results2 = $q->QUERY_SQL($sql);
if (!$q->ok) {
echo "<hr>{$q->mysql_error}<hr>";
}
$HASH_DAYS = $q->WEEK_TOTIMEHASH_FROM_TABLENAME($table);
while ($ligne2 = mysql_fetch_array($results2, MYSQL_ASSOC)) {
if ($classtr == "oddRow") {
$classtr = null;
} else {
$classtr = "oddRow";
}
$QuerySize = $ligne2["QuerySize"] / 1024;
$QuerySize = FormatBytes($QuerySize);
$timeQ = $HASH_DAYS[$ligne2["zDate"]];
$table_zoom = "dansguardian_events_" . date("Ymd", $timeQ);
$dateT = date("{l} {F} d", $timeQ);
if ($tpl->language == "fr") {
$dateT = date("{l} d {F} ", $timeQ);
}
$user = array();
if ($q->TABLE_EXISTS("{$table_zoom}")) {
$urlDEF = "squid.dansguardian_events.php?table={$table_zoom}&sitename={$ligne2["sitename"]}";
if ($ligne2["MAC"] != null) {
$url = "squid.dansguardian_events.php?table={$table_zoom}&field=MAC&value={$ligne2["MAC"]}&sitename={$ligne2["sitename"]}";
$user[] = "<a href=\"javascript:blur();\" Onclick=\"javascript:Loadjs('{$url}');\" style='font-size:12px;text-decoration:underline'>{$ligne2["MAC"]}</a>";
}
if ($ligne2["client"] != null) {
$url = "squid.dansguardian_events.php?table={$table_zoom}&field=CLIENT&value={$ligne2["client"]}&sitename={$ligne2["sitename"]}";
$user[] = "<a href=\"javascript:blur();\" Onclick=\"javascript:Loadjs('{$url}');\" style='font-size:12px;text-decoration:underline'>{$ligne2["client"]}</a>";
}
if ($ligne2["uid"] != null) {
$url = "squid.dansguardian_events.php?table={$table_zoom}&field=uid&value={$ligne2["uid"]}&sitename={$ligne2["sitename"]}";
$user[] = "<a href=\"javascript:blur();\" Onclick=\"javascript:Loadjs('{$url}');\" style='font-size:12px;text-decoration:underline'>{$ligne2["uid"]}</a>";
}
if ($ligne2["hostname"] != null) {
$url = "squid.dansguardian_events.php?table={$table_zoom}&field=hostname&value={$ligne2["hostname"]}&sitename={$ligne2["sitename"]}";
$user[] = "<a href=\"javascript:blur();\" Onclick=\"javascript:Loadjs('{$url}');\" style='font-size:12px;text-decoration:underline'>{$ligne2["hostname"]}</a>";
}
} else {
$user[] = "{$table_zoom} no such table";
}
$html = $html . "\n\t\t\t<tr class={$classtr}>\n\t\t\t\t\n\t\t\t\t<td width=1% nowrap valign='top'><strong style='font-size:12px'>{$dateT}</td>\n\t\t\t\t<td width=1% valign='top'><strong style='font-size:12px'>" . @implode("<br>", $user) . "</td>\n\t\t\t\t<td width=99% valign='top' align='left nowrap'>\n\t\t\t\t\n\t\t\t\t<a href=\"javascript:blur();\" Onclick=\"javascript:Loadjs('{$urlDEF}');\" \n\t\t\t\tstyle='font-size:12px;text-decoration:underline;font-weight:bold'>{$ligne2["sitename"]}</a></td>\n\t\t\t\t<td width=1% valign='top'><strong style='font-size:12px'>{$ligne2["hits"]}</td>\n\t\t\t\t<td width=1% valign='top'><strong style='font-size:12px'>{$QuerySize}</td>\n\t\t\t</tr>\n\t\t\t";
}
$html = $html . "</tbody></table>";
echo $tpl->_ENGINE_parse_body($html);
}