fetchq('SELECT * FROM misc');
$tstats = $sql->query('SHOW TABLE STATUS');
while ($t = $sql->fetch($tstats)) $tbl[$t['Name']]=$t;
/*
$sch_info = "";
$schemes = $sql->query('
SELECT COUNT(u.id) as schemecount, u.scheme, schemes.name
FROM users AS u
LEFT JOIN schemes ON (u.scheme = schemes.id)
WHERE (schemes.ord >= 0)
GROUP BY u.scheme
ORDER BY schemecount DESC
');
while ($row = $sql->fetch($schemes)) {
$sch_info .= "
$tccell1>$row[name]$tccell1>$row[schemecount]
";
} */
print "
$header
$tblstart
$tccellh>Records$tccellh> 
$tccell1s>Most posts within 24 hours:
$tccell2ls>$misc[maxpostsday], on ".date($dateformat,$misc['maxpostsdaydate'])."
$tccell1s>Most posts within 1 hour:
$tccell2ls>$misc[maxpostshour], on ".date($dateformat,$misc['maxpostshourdate'])."
$tccell1s>Most users online:
$tccell2ls>$misc[maxusers], on ".date($dateformat,$misc['maxusersdate'])."$misc[maxuserstext]
$tblend
".
/*
// This is kind of in Edit Profile already.
"$tblstart$tccellh colspan='2'>Scheme Usage Breakdown
$tccellh>Scheme Name$tccellh>Users
$sch_info
$tblend
".
*/
"$tblstart
$tccellh>Table name
$tccellh>Rows
$tccellh>Avg. data/row
$tccellh>Data size
$tccellh>Index size
$tccellh>Overhead
$tccellh>Total size
"
.tblinfo('posts_text')
.tblinfo('posts')
.tblinfo('pmsgs_text')
.tblinfo('pmsgs')
.tblinfo('postlayouts')
.tblinfo('threads')
.tblinfo('users')
.tblinfo('forumread')
.tblinfo('threadsread')
.tblinfo('postradar')
.tblinfo('ipbans')
.tblinfo('defines')
.tblinfo('dailystats')
.tblinfo('rendertimes')
."$tblend
$tblstart
$tccellhs colspan=9>Daily stats
$tccellcs>Date
$tccellcs>Total users
$tccellcs>Total posts
$tccellcs>Total threads
$tccellcs>Total views
$tccellcs>New users
$tccellcs>New posts
$tccellcs>New threads
$tccellcs>New views
";
$users=0;
$posts=0;
$threads=0;
$views=0;
$stats=$sql->query("SELECT * FROM dailystats");
while($day=$sql->fetch($stats)){
print "
$tccell1s>$day[date]
$tccell2s>$day[users]
$tccell2s>$day[posts]
$tccell2s>$day[threads]
$tccell2s>$day[views]
$tccell2s>".($day['users']-$users)."
$tccell2s>".($day['posts']-$posts)."
$tccell2s>".($day['threads']-$threads)."
$tccell2s>".($day['views']-$views)."
";
$users=$day['users'];
$posts=$day['posts'];
$threads=$day['threads'];
$views=$day['views'];
}
print $tblend.$footer;
printtimedif($startingtime);
function sp($sz) {
// $b="$sz B";
// if($sz>1023) $b=sprintf('%01.2f',$sz/1024).' kB';
// if($sz>10239) $b=sprintf('%01.1f',$sz/1024).' kB';
// if($sz>102399) $b=sprintf('%01.0f',$sz/1024).' kB';
// if($sz>1048575) $b=sprintf('%01.2f',$sz/1048576).' MB';
// if($sz>10485759) $b=sprintf('%01.1f',$sz/1048576).' MB';
// if($sz>104857599) $b=sprintf('%01.0f',$sz/1048576).' MB';
$b=number_format($sz,0,'.',',');
return $b;
}
function tblinfo($n) {
global $tbl,$tccell2,$tccell2l;
$t=$tbl[$n];
return "
$tccell2>$t[Name]
$tccell2l>".sp($t['Rows']) ."
$tccell2l>".sp($t['Avg_row_length'])."
$tccell2l>".sp($t['Data_length'])."
$tccell2l>".sp($t['Index_length'])."
$tccell2l>".sp($t['Data_free'])."
$tccell2l>".sp($t['Data_length']+$t['Index_length'])."
";
}
?>