2020-10-27 16:32:23 +01:00
|
|
|
|
<?php
|
|
|
|
|
|
2022-11-21 11:24:34 +01:00
|
|
|
|
require('lib/fnum.php');
|
|
|
|
|
|
2020-10-27 16:32:23 +01:00
|
|
|
|
echo('</nav>
|
2020-10-26 16:05:59 +01:00
|
|
|
|
<div class="scrwide">
|
|
|
|
|
<div class="scrwidein">
|
|
|
|
|
<section class="sectcontm">
|
2020-10-27 16:32:23 +01:00
|
|
|
|
<h3>'._('Statistics').'</h3>
|
2020-10-26 16:05:59 +01:00
|
|
|
|
<script language="JavaScript">
|
|
|
|
|
</script>
|
|
|
|
|
'.N);
|
|
|
|
|
|
|
|
|
|
function sp($num,$sing,$plur) {
|
|
|
|
|
if ($num==1)
|
|
|
|
|
return($sing);
|
|
|
|
|
else
|
|
|
|
|
return($plur);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$link=mysqli_connect($conf['db_host'],$conf['db_user_name'],$conf['db_user_password'],$conf['db_name'],$conf['db_port'],$conf['db_socket']) or muorimeglio(_('Couldn’t connect to database: ').mysqli_connect_error().' ['.mysqli_connect_errno().']',false);
|
|
|
|
|
mysqli_set_charset($link,'utf8mb4');
|
|
|
|
|
|
|
|
|
|
$res=mysqli_query($link,'SELECT MAX(Visits) AS MaxVisits, MAX(Hits) AS MaxHits FROM ZStats') or muorimeglio(__LINE__.': '.mysqli_error($link),true);
|
|
|
|
|
$row=mysqli_fetch_assoc($res);
|
|
|
|
|
$maxvisits=$row['MaxVisits'];
|
|
|
|
|
$maxhits=$row['MaxHits'];
|
|
|
|
|
|
|
|
|
|
echo('<p>'._('Statistics for the last 30 days.').'</p>'.N);
|
|
|
|
|
$now=time();
|
|
|
|
|
$tdstart=gmmktime(0,0,0,gmdate('n',$now),gmdate('j',$now),gmdate('Y',$now));
|
|
|
|
|
$limit=$tdstart-(30*24*60*60);
|
|
|
|
|
$res=mysqli_query($link,'SELECT * FROM ZStats WHERE TS >= '.$limit.' ORDER BY TS DESC') or muorimeglio(__LINE__.': '.mysqli_error($link),true);
|
2020-10-31 06:57:34 +01:00
|
|
|
|
$hlmap=array(
|
|
|
|
|
'ca'=>_('Catalan'),
|
|
|
|
|
'en'=>_('English'),
|
|
|
|
|
'es'=>_('Spanish'),
|
|
|
|
|
'fr'=>_('French'),
|
2022-11-23 13:03:18 +01:00
|
|
|
|
'gl'=>_('Galician'),
|
2022-11-23 18:57:05 +01:00
|
|
|
|
'it'=>_('Italian'),
|
|
|
|
|
'uk'=>_('Ukrainian')
|
2020-10-31 06:57:34 +01:00
|
|
|
|
);
|
|
|
|
|
$hpmap=array(
|
|
|
|
|
'home'=>_('Guide'),
|
|
|
|
|
'instances'=>_('Instances'),
|
|
|
|
|
'about'=>_('About'),
|
2020-10-31 07:21:59 +01:00
|
|
|
|
'stats'=>_('Statistics'),
|
2020-10-31 06:57:34 +01:00
|
|
|
|
'contribute'=>_('Contribute'),
|
|
|
|
|
'404'=>'404'
|
|
|
|
|
);
|
2020-10-26 16:05:59 +01:00
|
|
|
|
while ($row=mysqli_fetch_assoc($res)) {
|
2020-10-31 06:57:34 +01:00
|
|
|
|
$hl=explode(';',$row['HitsLang']);
|
|
|
|
|
$buf=array();
|
|
|
|
|
foreach($hl as $key=>$val) {
|
|
|
|
|
$val=explode(':',$val);
|
|
|
|
|
$buf[$hlmap[$val[0]]]=$val[1];
|
|
|
|
|
}
|
2020-10-26 16:05:59 +01:00
|
|
|
|
arsort($buf);
|
2020-10-31 06:57:34 +01:00
|
|
|
|
$hl='';
|
2022-11-21 11:24:34 +01:00
|
|
|
|
foreach($buf as $key=>$val) $hl.=$key.': '.fnum($val,0,$dlang).'; ';
|
2020-10-31 06:57:34 +01:00
|
|
|
|
$hl=_('Hits per language').': '.substr($hl,0,-2);
|
|
|
|
|
|
|
|
|
|
$hp=explode(';',$row['HitsPage']);
|
|
|
|
|
$buf=array();
|
|
|
|
|
foreach($hp as $key=>$val) {
|
|
|
|
|
$val=explode(':',$val);
|
|
|
|
|
$buf[$hpmap[$val[0]]]=$val[1];
|
|
|
|
|
}
|
2020-10-26 16:05:59 +01:00
|
|
|
|
arsort($buf);
|
2020-10-31 06:57:34 +01:00
|
|
|
|
$hp='';
|
2022-11-21 11:24:34 +01:00
|
|
|
|
foreach($buf as $key=>$val) $hp.=$key.': '.fnum($val,0,$dlang).'; ';
|
2020-10-31 06:57:34 +01:00
|
|
|
|
$hp=_('Hits per page').': '.substr($hp,0,-2);
|
|
|
|
|
|
2022-11-21 11:24:34 +01:00
|
|
|
|
echo('<div class="info">'.gmdate('d/m/Y',$row['TS']).': '.fnum($row['Visits'],0,$dlang).' <span class="visitslab">'.sp($row['Visits'],_('visit'),_('visits')).'</span>, '.fnum($row['Hits'],0,$dlang).' <span class="hitslab">'.sp($row['Hits'],_('hit'),_('hits')).'</span></div>'.N);
|
2020-10-31 06:57:34 +01:00
|
|
|
|
echo('<div class="info">'.$hl.'</div>'.N);
|
|
|
|
|
echo('<div class="info">'.$hp.'</div>'.N);
|
2020-10-26 16:05:59 +01:00
|
|
|
|
echo('<div class="visits" style="width:'.(100/$maxvisits*$row['Visits']).'%"></div>'.N);
|
|
|
|
|
echo('<div class="hits" style="width:'.(100/$maxhits*$row['Hits']).'%"></div>'.N);
|
|
|
|
|
echo('<div class="sep"></div>'.N);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mysqli_close($link);
|
|
|
|
|
|
2020-11-01 09:14:31 +01:00
|
|
|
|
echo('<div style="height:10px;"></div>
|
|
|
|
|
</section>
|
2020-10-26 16:05:59 +01:00
|
|
|
|
</div>
|
2020-10-27 16:32:23 +01:00
|
|
|
|
</div>'.N);
|
|
|
|
|
|
|
|
|
|
?>
|