function panel_categories(){
	$tpl=new templates();
	$page=CurrentPageName();
	$hour=$_GET["hour"];
	if(strlen($hour)==1){$hour="0$hour";}		
	$table=$_GET["table"];
	$q=new mysql_squid_builder();
	if($q->COUNT_ROWS($table)==0){
		echo $tpl->_ENGINE_parse_body("$title<center style='margin:50px'><H2>{error_no_data}</H2>$sql</center>");
		return;
	}
	
	$separator="<center><hr style='border:1px dotted #CCCCCC;width:80%'></center>";
	
	if(!$q->TABLE_EXISTS($table)){echo "<H3>".$tpl->_ENGINE_parse_body("{ERROR_NO_DATA}$field")."</h3>";}
	
	$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM $table WHERE `hour`={$_GET["hour"]}"));
	$downloadedINT=$ligne["tsize"];
	$downloaded=FormatBytes($downloadedINT/1024);
	
	$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM $table WHERE `hour`={$_GET["hour"]} AND cached=1"));
	$cachedINT=$ligne["tsize"];
	$cached=FormatBytes($cachedINT/1024);
	$pourc=$cachedINT/$downloadedINT;
	$pourc=$pourc*100;
	$pourc=round($pourc,2);
		
	$line=$tpl->_ENGINE_parse_body("$field{your_users_has_downloadedXD-XS-XP}$separator");
	$line=str_replace("XD", "<strong>$downloaded</strong>", $line);
	$line=str_replace("XS", "<strong>$cached</strong>", $line);
	$line=str_replace("XP", "<strong style='color:#CF1717'>$pourc%</strong>", $line);
	$html[]="<div style='font-size:12px;text-align:justify;margin-bottom:5px'>$line</div>";
	
	
	$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize,familysite,`hour` FROM $table 
	GROUP BY familysite,`hour` HAVING `hour`={$_GET["hour"]} ORDER BY tsize DESC LIMIT 0,1"));
	$XXWWWS=$ligne["familysite"];
	$XWSZE=FormatBytes($ligne["tsize"]/1024);
	
	$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT SUM(hits) as tsize,familysite,`hour` FROM $table 
	GROUP BY familysite,`hour` HAVING `hour`={$_GET["hour"]} ORDER BY tsize DESC LIMIT 0,1"));
	$XXWWWR=$ligne["familysite"];
	$XWSZR=$ligne["tsize"];
	$XWSCAT=familysite_MergeCategories(array($XXWWWS,$XXWWWR));
	
	$linkWebsite1="<a href=\"javascript:blur();\" 
	OnClick=\"javascript:Loadjs('squid.traffic.statistics.week.website.php?table=$table&field=familysite&www=$XXWWWS');\"
	style='font-weight:bold;text-decoration:underline'
	>";
	
	$linkWebsite2="<a href=\"javascript:blur();\" 
	OnClick=\"javascript:Loadjs('squid.traffic.statistics.week.website.php?table=$table&field=familysite&www=$XXWWWR');\"
	style='font-weight:bold;text-decoration:underline'
	>";	
	
	$line=$tpl->_ENGINE_parse_body("{phrase_the_most_websites}");
	$line=str_replace("XXWWWS", "$linkWebsite1$XXWWWS</a>", $line);
	$line=str_replace("XWSZE", "<strong>$XWSZE</strong>", $line);
	$line=str_replace("XXWWWR", "$linkWebsite2$XXWWWR</a>", $line);
	$line=str_replace("XWSZR", "<strong>$XWSZR</strong>", $line);
	$line=str_replace("XWSCAT", "<strong>$XWSCAT</strong>", $line);		
	$html[]="<div style='font-size:12px;text-align:justify'>$line</div>";
	
	$line=$tpl->_ENGINE_parse_body("{phrase_the_most_website_represent}");
	$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM $table WHERE familysite='$XXWWWS' AND `hour`={$_GET["hour"]}"));
	$XXWWWSPRC_bin=$ligne["tsize"];
	$XXWWWSPRC_size=FormatBytes($XXWWWSPRC_bin/1024);
	$XXWWWSPRC=$XXWWWSPRC_bin/$downloadedINT;
	$XXWWWSPRC=$XXWWWSPRC*100;
	$XXWWWSPRC=round($XXWWWSPRC,2);	
	
	$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM $table WHERE familysite='$XXWWWS' AND `hour`={$_GET["hour"]} AND cached=1"));
	$XXWWWSCHE_bin=$ligne["tsize"];
	$XXWWWSCHE_size=FormatBytes($XXWWWSCHE_bin/1024);

	

	
	$line=str_replace("XXWWWSPRC", "<strong>$XXWWWSPRC% ($XXWWWSPRC_size)</strong>", $line);
	$line=str_replace("XXWWWSCHE", "<strong>$XXWWWSCHE_size</strong>", $line);	
	$line=str_replace("XXWWWS", "$linkWebsite1$XXWWWS</a>", $line);

	$html[]="<div style='font-size:12px;text-align:justify;margin-top:10px'>
	<div style='color:#CF1717;font-weight:bold;margin-top:5px;font-size:13.5px'>$XXWWWS:</div>
	$line</div>";
	
// ******************************************************************************************************	
	$tabledetails="dansguardian_events_".date("Ymd");
	$sql="SELECT mins,COUNT(ID) as thits,SUM(QuerySize) as tsize 
	FROM (SELECT MINUTE(zDate) as mins,ID,QuerySize FROM $tabledetails WHERE HOUR(zDate)={$_GET["hour"]}) as t
	GROUP BY `mins` ORDER BY `mins` LIMIT 0,1";
	
	$ligne=mysql_fetch_array($q->QUERY_SQL($sql));
	if(!$q->ok){echo $q->mysql_error;}
	$MostActiveMinNum=$ligne["mins"];
	if(!is_numeric($MostActiveMinNum)){$MostActiveMinNum=0;}
	$MostActiveMinNumText=$MostActiveMinNum;
	if(strlen($MostActiveMinNumText)==1){$MostActiveMinNumText="0$MostActiveMinNumText";}
	$MostActiveDaySize=FormatBytes($ligne["tsize"]/1024);
	$title="{$hour}h$MostActiveMinNumText {phrase_most_time_activehour}";
	$prc=round($ligne["tsize"]/$downloadedINT,2)*100;
	
	$html[]="<div style='color:#CF1717;font-weight:bold;margin-top:5px;font-size:13.5px'>$title</div>
	<div style='font-size:12px;text-align:justify;'>{with} <strong>{$ligne["thits"]} {hits}</strong> {or} <strong>$MostActiveDaySize</strong> {it_represents} <strong>$prc%</strong> {of_bandwith}</div>
	
	<div style='font-size:12px;text-align:justify;margin-top:10px;margin-bottom:15px'>{phrase_thisisthegraph2}:</div>"; 
	
	$sql="SELECT mins,COUNT(ID) as thits 
	FROM (SELECT MINUTE(zDate) as mins,ID FROM $tabledetails WHERE HOUR(zDate)={$_GET["hour"]}) as t
	GROUP BY `mins` ORDER BY `mins`";
		$results=$q->QUERY_SQL($sql);
		while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){	
		$xdata[]=$ligne["mins"];
		$ydata[]=$ligne["thits"];
	}	
	$time=time();
	$targetedfile="ressources/logs/".basename(__FILE__).".".__FUNCTION__.".$table.$time.png";
	$gp=new artica_graphs();
	$gp->width=270;
	$gp->height=150;
	$gp->filename="$targetedfile";
	$gp->xdata=$xdata;
	$gp->ydata=$ydata;
	$gp->y_title=null;
	$gp->x_title=$tpl->_ENGINE_parse_body("{minutes}");
	$gp->title=null;
	$gp->margin0=true;
	$gp->Fillcolor="blue@0.9";
	$gp->color="146497";
	$gp->line_green();
	
	
	if(!is_file($targetedfile)){$targetedfile="img/nograph-000.png";}
	$html[]="<center style='margin-top:5px'><img src='$targetedfile'></center>";
	
	
	$id=md5($_GET["table"].$_GET["hour"]);
	$html[]="
	<script>
		if(!document.getElementById('panel-middle-$id')){alert('panel-middle-$id, no such id');}
		LoadAjax('panel-middle-$id','$page?panel-topwebistes=yes&time={$_GET["time"]}&hour={$_GET["hour"]}&table={$_GET["table"]}');
	</script>";
	
	
	echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
	
}
function paragraphe1()
{
    $table = $_GET["table"];
    $user = $_GET["user"];
    $field = $_GET["field"];
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table}"));
    $downloadedINT = $ligne["tsize"];
    $sql = "SELECT SUM(size) as tsize FROM {$table} WHERE `{$field}`='{$user}' AND cached=1";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $X3_bin = $ligne["tsize"];
    $X3_text = "<strong>" . FormatBytes($X3_bin / 1024) . "</strong>";
    $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table} WHERE `{$field}`='{$user}'"));
    $X1_bin = $ligne2["tsize"];
    $X1_text = "<strong>" . FormatBytes($X1_bin / 1024) . "</strong>";
    $PRC = $X3_bin / $X1_bin * 100;
    $PRC = round($PRC, 3);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(hits) as tsize FROM {$table} WHERE `{$field}`='{$user}'"));
    if (!$q->ok) {
        echo "<H4>{$q->mysql_error} line " . __LINE__ . "</H4>";
    }
    $X2_bin = $ligne["tsize"];
    $X2_text = "<strong>{$X2_bin}</strong>";
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(familysite) as familysite,`{$field}` FROM {$table} WHERE `{$field}`='{$user}'"));
    if (!$q->ok) {
        echo "<H4>{$q->mysql_error} line " . __LINE__ . "</H4>";
    }
    $X0_bin = $ligne["familysite"];
    $X0_text = "<strong>{$X0_bin}</strong>";
    $webstatsUserIntro1 = $tpl->_ENGINE_parse_body("{webstatsUserIntro1}");
    $webstatsUserIntro1 = str_replace("X3PRC", "<strong style='color:#CF1717'>{$PRC}%</strong>", $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X0", $X0_text, $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X1", $X1_text, $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X2", $X2_text, $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X3", $X3_text, $webstatsUserIntro1);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize,familysite,`{$field}` FROM {$table} GROUP BY familysite,`{$field}` HAVING `{$field}`='{$user}' ORDER BY tsize DESC LIMIT 0,1"));
    if (!$q->ok) {
        echo "<H4>{$q->mysql_error} line " . __LINE__ . "</H4>";
    }
    $XXWWWS = $ligne["familysite"];
    $XWSZE = FormatBytes($ligne["tsize"] / 1024);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(hits) as tsize,familysite,`{$field}` FROM {$table} GROUP BY familysite,`{$field}` HAVING `{$field}`='{$user}' ORDER BY tsize DESC LIMIT 0,1"));
    if (!$q->ok) {
        echo "<H4>{$q->mysql_error} line " . __LINE__ . "</H4>";
    }
    $XXWWWR = $ligne["familysite"];
    $XWSZR = $ligne["tsize"];
    $XWSCAT = familysite_MergeCategories(array($XXWWWS, $XXWWWR));
    $line = $tpl->_ENGINE_parse_body("{phrase_the_most_websites}");
    $line = str_replace("XXWWWS", "<strong>{$XXWWWS}</strong>", $line);
    $line = str_replace("XWSZE", "<strong>{$XWSZE}</strong>", $line);
    $line = str_replace("XXWWWR", "<strong>{$XXWWWR}</strong>", $line);
    $line = str_replace("XWSZR", "<strong>{$XWSZR}</strong>", $line);
    $line = str_replace("XWSCAT", "<strong>{$XWSCAT}</strong>", $line);
    $webstatsUserIntro2 = "<div style='font-size:12px;text-align:justify'>{$line}</div>";
    //*********************************************************************** GRAPHIQUE PAR JOUR
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `hour`,SUM(hits) as thits,SUM(size) as tsize,`{$field}`  \n\tFROM {$table} GROUP BY `hour`,`{$field}`  HAVING `{$field}`='{$user}' ORDER BY thits DESC LIMIT 0,1"));
    if (!$q->ok) {
        echo $q->mysql_error;
    }
    $MostActiveHourNum = $ligne["hour"];
    $MostActiveDaySize = FormatBytes($ligne["tsize"] / 1024);
    if (strlen($MostActiveHourNum) == 1) {
        $MostActiveHourNum = "0{$MostActiveHourNum}";
    }
    $title = "{$MostActiveHourNum}:00 {phrase_most_day_activehour} {for} {$user}";
    $prc = round($ligne["tsize"] / $downloadedINT, 2) * 100;
    $webstatsUserIntro3 = "<div style='color:#CF1717;font-weight:bold;margin-top:5px;font-size:13.5px'>{$title}</div>\n\t<div style='font-size:12px;text-align:justify;'>{with} <strong>{$ligne["thits"]} {hits}</strong> {or} <strong>{$MostActiveDaySize}</strong> {it_represents} <strong>{$prc}%</strong> {of_bandwith}</div>\n\t<div style='font-size:12px;text-align:justify;margin-top:10px;margin-bottom:15px'>{phrase_thisisthegraph1}:</div>";
    $sql = "SELECT `hour`,SUM(hits) as thits,`{$field}` FROM {$table} GROUP BY `hour`,`{$field}` HAVING  `{$field}`='{$user}' ORDER BY `hour`";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $xdata[] = $ligne["hour"];
        $ydata[] = $ligne["thits"];
    }
    $time = time();
    $arrayHREF = urlencode(base64_encode(serialize(array($xdata, $ydata))));
    $t = time();
    $graph1 = "<div style='margin-top:10px;width:400px;height:250px;' id='graph2-{$t}'><center><img src='img/wait_verybig_mini_red.gif'></center></div>\n\t\n\t\t\t\n\t<script>\n\t\t\n\t</script>\t";
    $HTML = "<p style='font-size:12px'>{$webstatsUserIntro1}</p>\n\t<p style='font-size:12px'>{$webstatsUserIntro2}</p>\n\t{$webstatsUserIntro3}\n\t{$graph1}\n\t<script>\n\tLoadjs('{$page}?paragraphe1-day-graph=yes&container=graph2-{$t}&data={$arrayHREF}');\n\tLoadUserReport2()</script>\n\t";
    echo $tpl->_ENGINE_parse_body($HTML);
}
function paragraphe1()
{
    $table = $_GET["table"];
    $user = $_GET["user"];
    $field = $_GET["field"];
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table}"));
    $downloadedINT = $ligne["tsize"];
    $sql = "SELECT SUM(size) as tsize FROM {$table} WHERE `{$field}`='{$user}' AND cached=1";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $X3_bin = $ligne["tsize"];
    $X3_text = "<strong>" . FormatBytes($X3_bin / 1024) . "</strong>";
    $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table} WHERE `{$field}`='{$user}'"));
    $X1_bin = $ligne2["tsize"];
    $X1_text = "<strong>" . FormatBytes($X1_bin / 1024) . "</strong>";
    $PRC = $X3_bin / $X1_bin * 100;
    $PRC = round($PRC, 3);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(hits) as tsize FROM {$table} WHERE `{$field}`='{$user}'"));
    $X2_bin = $ligne["tsize"];
    $X2_text = "<strong>{$X2_bin}</strong>";
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(familysite) as familysite,`{$field}` FROM {$table} WHERE `{$field}`='{$user}'"));
    $X0_bin = $ligne["familysite"];
    $X0_text = "<strong>{$X0_bin}</strong>";
    $webstatsUserIntro1 = $tpl->_ENGINE_parse_body("{webstatsUserIntro1}");
    $webstatsUserIntro1 = str_replace("X3PRC", "<strong style='color:#CF1717'>{$PRC}%</strong>", $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X0", $X0_text, $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X1", $X1_text, $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X2", $X2_text, $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X3", $X3_text, $webstatsUserIntro1);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize,familysite,`{$field}` FROM {$table} GROUP BY familysite,`{$field}` HAVING `{$field}`='{$user}' ORDER BY tsize DESC LIMIT 0,1"));
    $XXWWWS = $ligne["familysite"];
    $XWSZE = FormatBytes($ligne["tsize"] / 1024);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(hits) as tsize,familysite,`{$field}` FROM {$table} GROUP BY familysite,`{$field}` HAVING `{$field}`='{$user}' ORDER BY tsize DESC LIMIT 0,1"));
    $XXWWWR = $ligne["familysite"];
    $XWSZR = $ligne["tsize"];
    $XWSCAT = familysite_MergeCategories(array($XXWWWS, $XXWWWR));
    $line = $tpl->_ENGINE_parse_body("{phrase_the_most_websites}");
    $line = str_replace("XXWWWS", "<strong>{$XXWWWS}</strong>", $line);
    $line = str_replace("XWSZE", "<strong>{$XWSZE}</strong>", $line);
    $line = str_replace("XXWWWR", "<strong>{$XXWWWR}</strong>", $line);
    $line = str_replace("XWSZR", "<strong>{$XWSZR}</strong>", $line);
    $line = str_replace("XWSCAT", "<strong>{$XWSCAT}</strong>", $line);
    $webstatsUserIntro2 = "<div style='font-size:12px;text-align:justify'>{$line}</div>";
    //*********************************************************************** GRAPHIQUE PAR JOUR
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `day`,SUM(hits) as thits,SUM(size) as tsize,`{$field}`  \n\tFROM {$table} GROUP BY `day`,`{$field}`  HAVING `{$field}`='{$user}' ORDER BY thits DESC LIMIT 0,1"));
    if (!$q->ok) {
        echo $q->mysql_error;
    }
    $MostActiveDayNum = $ligne["day"] - 1;
    $MostActiveDaySize = FormatBytes($ligne["tsize"] / 1024);
    $Cyear = substr($table, 0, 4);
    $Cweek = substr($table, 4, 2);
    $Cweek = str_replace("_", "", $Cweek);
    $days = $q->getDaysInWeek($Cweek, $Cyear);
    $dayText = date('{l}', $days[$MostActiveDayNum]);
    $title = "{$dayText} {phrase_most_day_activeday} {for} {$user}";
    $prc = round($ligne["tsize"] / $downloadedINT, 2) * 100;
    $webstatsUserIntro3 = "<div style='color:#CF1717;font-weight:bold;margin-top:5px;font-size:13.5px'>{$title}</div>\n\t<div style='font-size:12px;text-align:justify;'>{with} <strong>{$ligne["thits"]} {hits}</strong> {or} <strong>{$MostActiveDaySize}</strong> {it_represents} <strong>{$prc}%</strong> {of_bandwith}</div>\n\t<div style='font-size:12px;text-align:justify;margin-top:10px;margin-bottom:15px'>{phrase_thisisthegraph1}:</div>";
    $sql = "SELECT `day`,SUM(hits) as thits,`{$field}` FROM {$table} GROUP BY `day`,`{$field}` HAVING  `{$field}`='{$user}' ORDER BY `day`";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $xdata[] = $ligne["day"];
        $ydata[] = $ligne["thits"];
    }
    $time = time();
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$table}.{$time}.png";
    $gp = new artica_graphs();
    $gp->width = 270;
    $gp->height = 150;
    $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)) {
        $targetedfile = "img/nograph-000.png";
    }
    $graph1 = "<center style='margin-top:5px'><img src='{$targetedfile}'></center>";
    $HTML = "<p style='font-size:12px'>{$webstatsUserIntro1}</p>\n\t<p style='font-size:12px'>{$webstatsUserIntro2}</p>\n\t{$webstatsUserIntro3}\n\t{$graph1}\n\t<script>LoadUserReport2()</script>\n\t";
    echo $tpl->_ENGINE_parse_body($HTML);
}
Exemplo n.º 4
0
function day_categories()
{
    $tpl = new templates();
    $page = CurrentPageName();
    if ($_GET["table"] == null) {
        $_GET["table"] = date('Ymd', strtotime($_GET["day"])) . "_hour";
    }
    $table = $_GET["table"];
    $q = new mysql_squid_builder();
    if ($q->COUNT_ROWS($table) == 0) {
        echo $tpl->_ENGINE_parse_body("{$title}<center style='margin:50px'><H2>{error_no_data}</H2>{$sql}</center>");
        return;
    }
    $separator = "<center><hr style='border:1px dotted #CCCCCC;width:80%'></center>";
    if (!$q->TABLE_EXISTS($table)) {
        echo "<H3>" . $tpl->_ENGINE_parse_body("{ERROR_NO_DATA}{$field}") . "</h3>";
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table}"));
    $downloadedINT = $ligne["tsize"];
    $downloaded = FormatBytes($downloadedINT / 1024);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table} WHERE cached=1"));
    $cachedINT = $ligne["tsize"];
    $cached = FormatBytes($cachedINT / 1024);
    $pourc = $cachedINT / $downloadedINT;
    $pourc = $pourc * 100;
    $pourc = round($pourc, 2);
    $line = $tpl->_ENGINE_parse_body("{$field}{your_users_has_downloadedXD-XS-XP}{$separator}");
    $line = str_replace("XD", "<strong>{$downloaded}</strong>", $line);
    $line = str_replace("XS", "<strong>{$cached}</strong>", $line);
    $line = str_replace("XP", "<strong style='color:#CF1717'>{$pourc}%</strong>", $line);
    $html[] = "<div style='font-size:12px;text-align:justify;margin-bottom:5px'>{$line}</div>";
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize,familysite FROM {$table} GROUP BY familysite ORDER BY tsize DESC LIMIT 0,1"));
    $XXWWWS = $ligne["familysite"];
    $XWSZE = FormatBytes($ligne["tsize"] / 1024);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(hits) as tsize,familysite FROM {$table} GROUP BY familysite ORDER BY tsize DESC LIMIT 0,1"));
    $XXWWWR = $ligne["familysite"];
    $XWSZR = $ligne["tsize"];
    $XWSCAT = familysite_MergeCategories(array($XXWWWS, $XXWWWR));
    $linkWebsite1 = "<a href=\"javascript:blur();\" \n\tOnClick=\"javascript:Loadjs('squid.traffic.statistics.week.website.php?table={$table}&field=familysite&www={$XXWWWS}');\"\n\tstyle='font-weight:bold;text-decoration:underline'\n\t>";
    $linkWebsite2 = "<a href=\"javascript:blur();\" \n\tOnClick=\"javascript:Loadjs('squid.traffic.statistics.week.website.php?table={$table}&field=familysite&www={$XXWWWR}');\"\n\tstyle='font-weight:bold;text-decoration:underline'\n\t>";
    $line = $tpl->_ENGINE_parse_body("{phrase_the_most_websites}");
    $line = str_replace("XXWWWS", "{$linkWebsite1}{$XXWWWS}</a>", $line);
    $line = str_replace("XWSZE", "<strong>{$XWSZE}</strong>", $line);
    $line = str_replace("XXWWWR", "{$linkWebsite2}{$XXWWWR}</a>", $line);
    $line = str_replace("XWSZR", "<strong>{$XWSZR}</strong>", $line);
    $line = str_replace("XWSCAT", "<strong>{$XWSCAT}</strong>", $line);
    $html[] = "<div style='font-size:12px;text-align:justify'>{$line}</div>";
    $line = $tpl->_ENGINE_parse_body("{phrase_the_most_website_represent}");
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table} WHERE familysite='{$XXWWWS}'"));
    $XXWWWSPRC_bin = $ligne["tsize"];
    $XXWWWSPRC_size = FormatBytes($XXWWWSPRC_bin / 1024);
    $XXWWWSPRC = $XXWWWSPRC_bin / $downloadedINT;
    $XXWWWSPRC = $XXWWWSPRC * 100;
    $XXWWWSPRC = round($XXWWWSPRC, 2);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table} WHERE familysite='{$XXWWWS}' AND cached=1"));
    $XXWWWSCHE_bin = $ligne["tsize"];
    $XXWWWSCHE_size = FormatBytes($XXWWWSCHE_bin / 1024);
    $line = str_replace("XXWWWSPRC", "<strong>{$XXWWWSPRC}% ({$XXWWWSPRC_size})</strong>", $line);
    $line = str_replace("XXWWWSCHE", "<strong>{$XXWWWSCHE_size}</strong>", $line);
    $line = str_replace("XXWWWS", "{$linkWebsite1}{$XXWWWS}</a>", $line);
    $html[] = "<div style='font-size:12px;text-align:justify;margin-top:10px'>\n\t<div style='color:#CF1717;font-weight:bold;margin-top:5px;font-size:13.5px'>{$XXWWWS}:</div>\n\t{$line}</div>";
    // ******************************************************************************************************
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `hour`,SUM(hits) as thits,SUM(size) as tsize  \n\tFROM {$table} GROUP BY `hour` ORDER BY thits DESC LIMIT 0,1"));
    if (!$q->ok) {
        echo $q->mysql_error;
    }
    $MostActiveHourNum = $ligne["hour"];
    $MostActiveHourNumText = $MostActiveHourNum;
    if (strlen($MostActiveHourNumText) == 1) {
        $MostActiveHourNumText = "0{$MostActiveHourNumText}";
    }
    $MostActiveDaySize = FormatBytes($ligne["tsize"] / 1024);
    $time = $q->DAY_TABLENAME_TO_TIME($table);
    $hourQuery = $ligne["hour"];
    $title = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.traffic.panel.hour.php?js=yes&time={$time}&hour={$hourQuery}');\"\n\tstyle='color:#CF1717;font-weight:bold;text-decoration:underline'>\n\t{$MostActiveHourNumText}h00</a> {phrase_most_hour_activehour}";
    $prc = round($ligne["tsize"] / $downloadedINT, 2) * 100;
    $html[] = "<div style='color:#CF1717;font-weight:bold;margin-top:5px;font-size:13.5px'>{$title}</div>\n\t<div style='font-size:12px;text-align:justify;'>{with} <strong>{$ligne["thits"]} {hits}</strong> {or} <strong>{$MostActiveDaySize}</strong> {it_represents} <strong>{$prc}%</strong> {of_bandwith}</div>\n\t\n\t<div style='font-size:12px;text-align:justify;margin-top:10px;margin-bottom:15px'>{phrase_thisisthegraph2}:</div>";
    $sql = "SELECT `hour`,SUM(hits) as thits FROM {$table} GROUP BY `hour` ORDER BY `hour`";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $xdata[] = $ligne["hour"];
        $ydata[] = $ligne["thits"];
    }
    $time = time();
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$table}.{$time}.png";
    $gp = new artica_graphs();
    $gp->width = 270;
    $gp->height = 150;
    $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();
    if (!is_file($targetedfile)) {
        $targetedfile = "img/nograph-000.png";
    }
    $html[] = "<center style='margin-top:5px'><img src='{$targetedfile}'></center>";
    $id = md5($_GET["table"]);
    $html[] = "\n\t<script>\n\t\tif(!document.getElementById('panel-middle-{$id}')){alert('panel-middle-{$id}, no such id');}\n\t\tLoadAjax('panel-middle-{$id}','{$page}?panel-topwebistes-day=yes&table={$table}');\n\t</script>";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
Exemplo n.º 5
0
function week_categories()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $year = date("Y");
    $week = intval(date('W'));
    if ($_GET["table"] == null) {
        $table = "{$year}{$week}_week";
    } else {
        $table = $_GET["table"];
    }
    $q = new mysql_squid_builder();
    if ($q->COUNT_ROWS($table) == 0) {
        echo $tpl->_ENGINE_parse_body("{$title}<center style='margin:50px'><H2>{error_no_datas}</H2>{$sql} ({$table} {empty})</center>");
        return;
    }
    $separator = "<center><hr style='border:1px dotted #CCCCCC;width:80%'></center>";
    if (!$q->TABLE_EXISTS($table)) {
        echo "<H3>" . $tpl->_ENGINE_parse_body("{week_table_was_not_builded}{$field}") . "</h3>";
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table}"));
    $downloadedINT = $ligne["tsize"];
    $downloaded = FormatBytes($downloadedINT / 1024);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table} WHERE cached=1"));
    $cachedINT = $ligne["tsize"];
    $cached = FormatBytes($cachedINT / 1024);
    $pourc = $cachedINT / $downloadedINT;
    $pourc = $pourc * 100;
    $pourc = round($pourc, 2);
    $line = $tpl->_ENGINE_parse_body("{$field}{this_week_your_users_has_downloadedXD-XS-XP}{$separator}");
    $line = str_replace("XD", "<strong>{$downloaded}</strong>", $line);
    $line = str_replace("XS", "<strong>{$cached}</strong>", $line);
    $line = str_replace("XP", "<strong style='color:#CF1717'>{$pourc}%</strong>", $line);
    $html[] = "<div style='font-size:12px;text-align:justify;margin-bottom:5px'>{$line}</div>";
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize,familysite FROM {$table} GROUP BY familysite ORDER BY tsize DESC LIMIT 0,1"));
    $XXWWWS = $ligne["familysite"];
    $XWSZE = FormatBytes($ligne["tsize"] / 1024);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(hits) as tsize,familysite FROM {$table} GROUP BY familysite ORDER BY tsize DESC LIMIT 0,1"));
    $XXWWWR = $ligne["familysite"];
    $XWSZR = $ligne["tsize"];
    $XWSCAT = familysite_MergeCategories(array($XXWWWS, $XXWWWR));
    $linkWebsite1 = "<a href=\"javascript:blur();\" \n\tOnClick=\"javascript:Loadjs('squid.traffic.statistics.week.website.php?table={$table}&field=familysite&www={$XXWWWS}');\"\n\tstyle='font-weight:bold;text-decoration:underline'\n\t>";
    $linkWebsite2 = "<a href=\"javascript:blur();\" \n\tOnClick=\"javascript:Loadjs('squid.traffic.statistics.week.website.php?table={$table}&field=familysite&www={$XXWWWR}');\"\n\tstyle='font-weight:bold;text-decoration:underline'\n\t>";
    $line = $tpl->_ENGINE_parse_body("{phrase_the_most_websites}");
    $line = str_replace("XXWWWS", "{$linkWebsite1}{$XXWWWS}</a>", $line);
    $line = str_replace("XWSZE", "<strong>{$XWSZE}</strong>", $line);
    $line = str_replace("XXWWWR", "{$linkWebsite2}{$XXWWWR}</a>", $line);
    $line = str_replace("XWSZR", "<strong>{$XWSZR}</strong>", $line);
    $line = str_replace("XWSCAT", "<strong>{$XWSCAT}</strong>", $line);
    $html[] = "<div style='font-size:12px;text-align:justify'>{$line}</div>";
    $line = $tpl->_ENGINE_parse_body("{phrase_the_most_website_represent}");
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table} WHERE familysite='{$XXWWWS}'"));
    $XXWWWSPRC_bin = $ligne["tsize"];
    $XXWWWSPRC_size = FormatBytes($XXWWWSPRC_bin / 1024);
    $XXWWWSPRC = $XXWWWSPRC_bin / $downloadedINT;
    $XXWWWSPRC = $XXWWWSPRC * 100;
    $XXWWWSPRC = round($XXWWWSPRC, 2);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table} WHERE familysite='{$XXWWWS}' AND cached=1"));
    $XXWWWSCHE_bin = $ligne["tsize"];
    $XXWWWSCHE_size = FormatBytes($XXWWWSCHE_bin / 1024);
    $line = str_replace("XXWWWSPRC", "<strong>{$XXWWWSPRC}% ({$XXWWWSPRC_size})</strong>", $line);
    $line = str_replace("XXWWWSCHE", "<strong>{$XXWWWSCHE_size}</strong>", $line);
    $line = str_replace("XXWWWS", "{$linkWebsite1}{$XXWWWS}</a>", $line);
    $html[] = "<div style='font-size:12px;text-align:justify;margin-top:10px'>\n\t<div style='color:#CF1717;font-weight:bold;margin-top:5px;font-size:13.5px'>{$XXWWWS}:</div>\n\t{$line}</div>";
    // ******************************************************************************************************
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `day`,SUM(hits) as thits,SUM(size) as tsize  FROM {$table} GROUP BY `day` ORDER BY thits DESC LIMIT 0,1"));
    if (!$q->ok) {
        echo $q->mysql_error;
    }
    $MostActiveDayNum = $ligne["day"] - 1;
    $MostActiveDaySize = FormatBytes($ligne["tsize"] / 1024);
    $Cyear = substr($table, 0, 4);
    $Cweek = substr($table, 4, 2);
    $Cweek = str_replace("_", "", $Cweek);
    $days = getDaysInWeek($Cweek, $Cyear);
    $dayText = date('{l}', $days[$MostActiveDayNum]);
    $TimeWeek = strtotime($Cyear . '0104 +' . ($Cweek - 1) . ' weeks');
    $DayTime = date('Y-m', $TimeWeek) . "-" . date('d', $days[$MostActiveDayNum]);
    $DayTable = date('Ymd', strtotime($DayTime)) . "_hour";
    $dayText = "<a href=\"javascript:blur();\" \n\tOnClick=\"javascript:Loadjs('squid.traffic.panel.day.php?js=yes&table={$DayTable}');\"\n\tstyle='color:#CF1717;font-weight:bold;text-decoration:underline'>{$dayText}</a>";
    $title = "{$dayText} {phrase_most_day_activeday}";
    $prc = round($ligne["tsize"] / $downloadedINT, 2) * 100;
    $html[] = "<div style='color:#CF1717;font-weight:bold;margin-top:5px;font-size:13.5px'>{$title}</div>\n\t<div style='font-size:12px;text-align:justify;'>\n\t{with} <strong>{$ligne["thits"]} {hits}</strong> {or} <strong>{$MostActiveDaySize}</strong> {it_represents} <strong>{$prc}%</strong> {of_bandwith}</div>\n\t\n\t<div style='font-size:12px;text-align:justify;margin-top:10px;margin-bottom:15px'>{phrase_thisisthegraph1}:</div>";
    $sql = "SELECT `day`,SUM(hits) as thits FROM {$table} GROUP BY `day` ORDER BY `day`";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $day = $ligne["day"] - 1;
        $dayText = date('{l} d', $days[$day]);
        $DayTable = date('Ymd', $days[$day]) . "_hour";
        $TimeWeek = strtotime($Cyear . '0104 +' . ($Cweek - 1) . ' weeks');
        $DayTime = date('Y-m', $TimeWeek) . "-" . date('d', $days[$day]);
        $dayText = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.traffic.panel.day.php?js=yes&table={$DayTable}');\" style='font-weight:bold;text-decoration:underline'>{$dayText}</a>";
        $tr[] = "\n\t\t<tr>\n\t\t\t<td class=legend nowrap>{$dayText}:</td>\n\t\t\t<td nowrap><strong style='font-size:13px'>" . numberFormat($ligne["thits"], 0, "", " ") . " {hits}</td>\n\t\t</tr>\n\t\t";
        $xdata[] = $ligne["day"];
        $ydata[] = $ligne["thits"];
    }
    $time = time();
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$table}.{$time}.png";
    $gp = new artica_graphs();
    $gp->width = 270;
    $gp->height = 150;
    $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)) {
        $targetedfile = "img/nograph-000.png";
    }
    $html[] = "<center style='margin-top:5px'><img src='{$targetedfile}'></center>\n\t<table style='width:50%'><tbody>" . @implode("\n", $tr) . "</tbody></table>\n\t";
    $html[] = "\n\t<script>\n\t\tLoadAjax('panel-middle-top','{$page}?panel-topwebistes-week=yes&table={$table}');\n\t</script>";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function paragraphe1()
{
    $table = $_GET["table"];
    $user = $_GET["user"];
    $field = $_GET["field"];
    $category = $_GET["category"];
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $dans = new dansguardian_rules();
    $categoriesExplain = $dans->LoadBlackListes();
    $separator = "<center><hr style='border:1px dotted #CCCCCC;width:80%'></center>";
    if (strpos($category, ",") > 0) {
        $categories = explode(",", $category);
        while (list($a, $b) = each($categories)) {
            $titleCat = $titleCat . "<div style='font-weight:bold;border-bottom:1px solid #CCCCCC'>{$b}:</div>\n\t\t\t<div style='font-size:12px;margin-bottom:8px;font-style:italic'><i>{$categoriesExplain["{$b}"]}</i></div>";
        }
    } else {
        $titleCat = "<div style='font-weight:bold;border-bottom:1px solid #CCCCCC;font-size:13.5px'>{category}: {$category}</div>\n\t<div style='font-size:12px;margin-bottom:8px;font-style:italic'>{$categoriesExplain["{$category}"]}</div>";
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize FROM {$table}"));
    $downloadedINT = $ligne["tsize"];
    $sql = "SELECT COUNT(sitename) as tcount FROM {$table} WHERE category='{$category}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $NombreDeSites = $ligne["tcount"];
    $sql = "SELECT SUM(size) as tsize FROM {$table} WHERE `category`='{$category}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $total_category_size_bin = $ligne["tsize"];
    $total_category_size_text = "<strong>" . FormatBytes($total_category_size_bin / 1024) . "</strong>";
    $sql = "SELECT SUM(hits) as tsize FROM {$table} WHERE `category`='{$category}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $total_category_hits_bin = $ligne["tsize"];
    $sql = "SELECT SUM(size) as tsize FROM {$table} WHERE `category`='{$category}' AND cached=1";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $total_category_cache_bin = $ligne["tsize"];
    $total_category_cache_text = "<strong>" . FormatBytes($total_category_size_bin / 1024) . "</strong>";
    $PRC = $total_category_size_bin / $downloadedINT * 100;
    $PRC = round($PRC, 3);
    $text2 = $tpl->_ENGINE_parse_body("{webstatsCatIntro2}");
    $text2 = str_replace("XMB", "<strong>{$total_category_size_text}</strong>", $text2);
    $text2 = str_replace("XRQ", "<strong>{$total_category_hits_bin}</strong>", $text2);
    $text2 = str_replace("XPRC", "<strong>{$PRC}%</strong>", $text2);
    //*****************************************************************************************
    $sql = "SELECT SUM(size) as tsize,sitename,category FROM {$table} GROUP BY sitename,category HAVING `category`='{$category}' ORDER BY tsize DESC";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $siteWebLeplusLourd = $ligne["sitename"];
    $siteWebLeplusLourd_bin = $ligne["tsize"];
    $siteWebLeplusLourd_text = FormatBytes($ligne["tsize"] / 1024);
    $sql = "SELECT SUM(hits) as tsize,sitename,category FROM {$table} GROUP BY sitename,category HAVING `category`='{$category}' ORDER BY tsize DESC";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $siteWebLeplusVisite = $ligne["sitename"];
    $siteWebLeplusVisite_bin = $ligne["tsize"];
    $catz = sitename_MergeCategories(array($siteWebLeplusLourd, $siteWebLeplusVisite));
    $phrase_the_most_websites = $tpl->_ENGINE_parse_body("{phrase_the_most_websites}");
    $phrase_the_most_websites = str_replace("XXWWWS", "<strong>{$siteWebLeplusLourd}</strong>", $phrase_the_most_websites);
    $phrase_the_most_websites = str_replace("XWSZE", "<strong>{$siteWebLeplusLourd_text}</strong>", $phrase_the_most_websites);
    $phrase_the_most_websites = str_replace("XXWWWR", "<strong>{$siteWebLeplusVisite}</strong>", $phrase_the_most_websites);
    $phrase_the_most_websites = str_replace("XWSZR", "<strong>{$siteWebLeplusVisite_bin}</strong>", $phrase_the_most_websites);
    $phrase_the_most_websites = str_replace("XWSCAT", $catz, $phrase_the_most_websites);
    $phrase_the_most_websites = "<div style='font-size:12px;'>{$phrase_the_most_websites}</div>";
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(hits) as tsize FROM {$table} WHERE `{$field}`='{$user}'"));
    $X2_bin = $ligne["tsize"];
    $X2_text = "<strong>{$X2_bin}</strong>";
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(familysite) as familysite,`{$field}` FROM {$table} WHERE `{$field}`='{$user}'"));
    $X0_bin = $ligne["familysite"];
    $X0_text = "<strong>{$X0_bin}</strong>";
    $webstatsUserIntro1 = $tpl->_ENGINE_parse_body("{webstatsUserIntro1}");
    $webstatsUserIntro1 = str_replace("X3PRC", "<strong style='color:#CF1717'>{$PRC}%</strong>", $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X0", $X0_text, $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X1", $X1_text, $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X2", $X2_text, $webstatsUserIntro1);
    $webstatsUserIntro1 = str_replace("X3", $X3_text, $webstatsUserIntro1);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as tsize,familysite,`{$field}` FROM {$table} GROUP BY familysite,`{$field}` HAVING `{$field}`='{$user}' ORDER BY tsize DESC LIMIT 0,1"));
    $XXWWWS = $ligne["familysite"];
    $XWSZE = FormatBytes($ligne["tsize"] / 1024);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(hits) as tsize,familysite,`{$field}` FROM {$table} GROUP BY familysite,`{$field}` HAVING `{$field}`='{$user}' ORDER BY tsize DESC LIMIT 0,1"));
    $XXWWWR = $ligne["familysite"];
    $XWSZR = $ligne["tsize"];
    $XWSCAT = familysite_MergeCategories(array($XXWWWS, $XXWWWR));
    $line = $tpl->_ENGINE_parse_body("{phrase_the_most_websites}");
    $line = str_replace("XXWWWS", "<strong>{$XXWWWS}</strong>", $line);
    $line = str_replace("XWSZE", "<strong>{$XWSZE}</strong>", $line);
    $line = str_replace("XXWWWR", "<strong>{$XXWWWR}</strong>", $line);
    $line = str_replace("XWSZR", "<strong>{$XWSZR}</strong>", $line);
    $line = str_replace("XWSCAT", "<strong>{$XWSCAT}</strong>", $line);
    $webstatsUserIntro2 = "<div style='font-size:12px;text-align:justify'>{$line}</div>";
    //*********************************************************************** GRAPHIQUE PAR JOUR
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `day`,SUM(hits) as thits,SUM(size) as tsize,\n\t`category`  FROM {$table} GROUP BY `day`,`category`  HAVING `category`='{$category}' ORDER BY thits DESC LIMIT 0,1"));
    if (!$q->ok) {
        echo $q->mysql_error;
    }
    $MostActiveDayNum = $ligne["day"] - 1;
    $MostActiveDaySize = FormatBytes($ligne["tsize"] / 1024);
    $Cyear = substr($table, 0, 4);
    $Cweek = substr($table, 4, 2);
    $Cweek = str_replace("_", "", $Cweek);
    $days = $q->getDaysInWeek($Cweek, $Cyear);
    $dayText = date('{l}', $days[$MostActiveDayNum]);
    $title = "{$dayText} {phrase_most_day_activeday} {for} {$category}";
    $prc = round($ligne["tsize"] / $downloadedINT, 2) * 100;
    $webstatsUserIntro3 = "<div style='color:#CF1717;font-weight:bold;margin-top:5px;font-size:13.5px'>{$title}</div>\n\t<div style='font-size:12px;text-align:justify;'>{with} <strong>{$ligne["thits"]} {hits}</strong> {or} <strong>{$MostActiveDaySize}</strong> {it_represents} <strong>{$prc}%</strong> {of_bandwith}</div>\n\t<div style='font-size:12px;text-align:justify;margin-top:10px;margin-bottom:15px'>{phrase_thisisthegraph1}:</div>";
    $sql = "SELECT `day`,SUM(hits) as thits,`category` FROM {$table} GROUP BY `day`,category HAVING category='{$category}'  ORDER BY `day`";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $xdata[] = $ligne["day"];
        $ydata[] = $ligne["thits"];
    }
    $time = time();
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$table}.{$time}.png";
    $gp = new artica_graphs();
    $gp->width = 270;
    $gp->height = 150;
    $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)) {
        $targetedfile = "img/nograph-000.png";
    }
    $graph1 = "<center style='margin-top:5px'><img src='{$targetedfile}'></center>";
    $HTML = "{$titleCat}\n\t<p style='font-size:12px'><strong>{$NombreDeSites}</strong> {webstatsCatIntro1}.</p>\n\t<p style='font-size:12px'>{$text2}</p>\n\t{$phrase_the_most_websites}\n\t{$separator}\n\t{$webstatsUserIntro3}\n\t{$graph1}\n\t\n\t<script>LoadUserReport2()</script>\n\t";
    echo $tpl->_ENGINE_parse_body($HTML);
}