Old stuff/old_sites/epik/include/stats.php
(Deskargatu)
<div class="article">
<h2>Stats</h2>
<? if ($axx > 8)
{
?>
<div class="element">
<h2>Ip's des dernieres modifications / Ajouts (Admin)</h2>
<div>
<?
read_stat("account");
read_stat("article");
read_stat("breves");
read_stat("edito");
read_stat("mail");
read_stat("visites");
?>
</div>
</div>
<? } ?>
<div class="element">
<h2>Stats des derniers jours</h2>
<div>
<?
function max_read($type)
{
$query = "SELECT MAX($type) FROM stats";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) == 0) { return 0; }
else {
$row =mysql_fetch_array($result);
return $row[0];
}
}
$max_article = max_read("article");
$max_account = max_read("account");
$max_breves = max_read("breves");
$max_edito = max_read("edito");
$max_mail = max_read("mail");
$max_visites = max_read("visites");
$query = "SELECT * FROM stats ORDER BY annee,mois,jour LIMIT 10";
$result = mysql_query($query) or die(mysql_error());
echo "<dl>\n";
while ($row = mysql_fetch_assoc($result))
{
echo "<dt>".$row["jour"]."/".$row["mois"]."/".$row["annee"]."</dt> ";
foreach (array("account","article","breves","edito","mail","visites") as $key)
{
$width = ceil($row[$key]/${"max_".$key}*300);
echo "
<dd>$key:".$row[$key]."/".${"max_".$key}."
<div style=\"float:left;background-color:#eaf8ba; border:1px solid #000; margin:0px;padding:0px; height:5px; width:".$width."px\"></div>
<div style=\"background-color:#e5e5e5; border:1px solid #000; margin:0px;padding:0px; height:5px; width:300px\"></div>
</dd>
";
}
}
echo "</dl>\n";
?>
</div>
</div>
</div>