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,$tccell2s,$tccell2ls;
    $t=$tbl[$n];
    return "
	
	$tccell2s>$t[Name]
	$tccell2s>$t[Rows]
	$tccell2ls>".sp($t[Avg_row_length])."
	$tccell2ls>".sp($t[Data_length])."
	$tccell2ls>".sp($t[Index_length])."
	$tccell2ls>".sp($t[Data_free])."
	$tccell2ls>".sp($t[Data_length]+$t[Index_length]);
  }
  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
$tblstart
	$tccellhs>Table name
	$tccellhs>Rows
	$tccellhs>Avg. data/row
	$tccellhs>Data size
	$tccellhs>Index size
	$tccellhs>Unused data
	$tccellhs>Total size"
	.tblinfo('posts_text')
	.tblinfo('posts')
	.tblinfo('pmsgs_text')
	.tblinfo('pmsgs')
	.tblinfo('postlayouts')
	.tblinfo('threads')
	.tblinfo('users')
	.tblinfo('poll')
	.tblinfo('poll_choices')
	.tblinfo('pollvotes')
	.tblinfo('announcements')
	.tblinfo('forumread')
	.tblinfo('userratings')
	.tblinfo('postradar')
	.tblinfo('favorites')
	."$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=mysql_query("SELECT * FROM dailystats");
  while($day=mysql_fetch_array($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);
?>