<?
include("../include/common.php");
error_reporting(0);
session_start();
islogin();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style/index.css" />
<title></title>
</head>
<script language="javascript">
function show(div1,id)
{
	
	if(id=="1")
	{
		document.getElementById(div1).style.display="block";
	}
	if(id=="0")
	{
		document.getElementById(div1).style.display="none";
	}
}
</script>
<body>
<table width="90%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" bordercolordark="#FFFFFF">
  <tr>
    <td height="23">&nbsp;</td>
    <td align="center" class="title">表名</td>
    <td align="center" class="title">记录数</td>
    <td align="center" class="title">操作</td>
  </tr>
<?

$mysql->query("show tables");

while($arr=$mysql->fetcharray())
{
	$table[]=$arr[0];
}
foreach($table as $tab)
{
$records=$mysql->numfields("select * from $tab");
$mysql->query("show create table $tab");
$table=$mysql->fetcharray();
$table=str_replace("\n","<br>",$table);
print<<<EOT
  <tr>
    <td align="center"></td>
    <td align="center">{$tab}</td>
    <td align="center">{$records}</td>
    <td align="center"><a href="db.php?action=youhua&table={$tab}">优化</a> -  <a href="db.php?action=repair&table={$tab}">修复</a> - <a href="#" onmouseover="show('{$tab}','1')" onmouseout="show('{$tab}','0')">结构</a><div style=" background-color:#fff;position:absolute;display:none;padding-left:1%; width:200px;;text-align:left" id="{$tab}">{$table[1]}</div></td>
  </tr>
EOT;
}
?>
  <tr>
    <td height="23" colspan="4"><a href="db.php?action=allyouhua">全部优化</a> - <a href="db.php?action=allrepair">全部修复</a> - <a href="db.php?action=struct">备份数据库结构</a> - <a href="db.php?action=backup">全部备份(结构和数据)</a> -  <a href="db.php?action=huanyuan">还原(文件大于1M程序会自动分卷还原)</a></td>
  </tr>
</table>
</body>
</html>