Split daily stats to own page, fix a stats link

This commit is contained in:
Xkeeper 2018-11-04 14:47:54 -08:00
parent 5cf3655772
commit 3df3b5e09f
No known key found for this signature in database
GPG Key ID: 397C04773ABE4045
2 changed files with 64 additions and 39 deletions

59
stats-daily.php Normal file
View File

@ -0,0 +1,59 @@
<?php
require 'lib/function.php';
require 'lib/layout.php';
print "
$header
<br>$tblstart
<tr>$tccellh>Information</td></tr>
<tr>$tccellc>
<br>
Daily stats for the board. This page might take a while to fully display.
<br><br>
</td>
</tr>
$tblend
<br>
$tblstart<tr>
$tccellh colspan=9>Daily stats<tr>
$tccellc>Date</td>
$tccellc>Total users</td>
$tccellc>Total posts</td>
$tccellc>Total threads</td>
$tccellc>Total views</td>
$tccellc>New users</td>
$tccellc>New posts</td>
$tccellc>New threads</td>
$tccellc>New views</td></tr>
";
$users=0;
$posts=0;
$threads=0;
$views=0;
$stats=$sql->query("SELECT * FROM dailystats");
$oldyear = "";
while($day=$sql->fetch($stats)){
$year = substr($day['date'], 6);
if ($year !== $oldyear) {
print "<tr>
$tccellh colspan=9>20$year<tr>";
$oldyear = $year;
}
print "<tr>
$tccell1>$day[date]</td>
$tccell2>". number_format($day['users']) ."</td>
$tccell2>". number_format($day['posts']) ."</td>
$tccell2>". number_format($day['threads']) ."</td>
$tccell2>". number_format($day['views']) ."</td>
$tccell2>". number_format($day['users']-$users)."</td>
$tccell2>". number_format($day['posts']-$posts)."</td>
$tccell2>". number_format($day['threads']-$threads)."</td>
$tccell2>". number_format($day['views']-$views)."</td></tr>
";
$users=$day['users'];
$posts=$day['posts'];
$threads=$day['threads'];
$views=$day['views'];
}
print $tblend.$footer;
printtimedif($startingtime);

View File

@ -31,7 +31,7 @@
<li><a href='activeusers.php'>Recently active posters</a></li>
<li><a href='acs.php'>Daily poster rankings</a></li>
<li><a href='milestones.php'>Post milestones</a></li>
<li><a href='sigsize.php'>Biggest posters</a></li>
<li><a href='biggestposters.php'>Biggest posters</a></li>
<li><a href='sigsize.php'>Largest post layouts</a></li>
<li><a href='sigsize.php?bio=1'>Largest bios</a></li>
<li><a href='activity.php?u=". ($loguserid ? $loguserid : 1) ."'>Graph of your posting history</a> (change the ID in the URL to see others)</li>
@ -39,6 +39,7 @@
<li><a href='activity3.php'>Graph of total post count and posts per day</a></li>
<li><a href='activity3u.php'>Graph of active users per day</a></li>
<li><a href='avatar.php'>Mood avatars</a></li>
<li><a href='stats-daily.php'>Daily board-wide statistics</a></li>
</ul>
</td>
</tr>
@ -82,42 +83,9 @@
.tblinfo('dailystats')
.tblinfo('rendertimes')
."$tblend
<br>
$tblstart<tr>
$tccellhs colspan=9>Daily stats<tr>
$tccellcs>Date</td>
$tccellcs>Total users</td>
$tccellcs>Total posts</td>
$tccellcs>Total threads</td>
$tccellcs>Total views</td>
$tccellcs>New users</td>
$tccellcs>New posts</td>
$tccellcs>New threads</td>
$tccellcs>New views</td></tr>
";
$users=0;
$posts=0;
$threads=0;
$views=0;
$stats=$sql->query("SELECT * FROM dailystats");
while($day=$sql->fetch($stats)){
print "<tr>
$tccell1s>$day[date]</td>
$tccell2s>$day[users]</td>
$tccell2s>$day[posts]</td>
$tccell2s>$day[threads]</td>
$tccell2s>$day[views]</td>
$tccell2s>".($day['users']-$users)."</td>
$tccell2s>".($day['posts']-$posts)."</td>
$tccell2s>".($day['threads']-$threads)."</td>
$tccell2s>".($day['views']-$views)."</td></tr>
";
$users=$day['users'];
$posts=$day['posts'];
$threads=$day['threads'];
$views=$day['views'];
}
print $tblend.$footer;
print $footer;
printtimedif($startingtime);
@ -147,5 +115,3 @@
$tccell2l>".sp($t['Data_free'])."</td>
$tccell2l>".sp($t['Data_length']+$t['Index_length'])."</td></tr>";
}
?>