<table border="1" cellspacing="0" cellpadding="0">
<?php
if ($opt_tables)
{
$query_text = "OPTIMIZE TABLE ";
foreach ($opt_tables as $key => $value)
{
$query_text .= $value . ", ";
}
$query_text = substr($query_text, 0, -2);
@mysql_db_query($database, $query_text, $db_link) or mysql_client_error_msg($query_text, __FILE__, __LINE__);
echo "<tr bgcolor=\"" . (($row++ % 2 == 1) ? $color="#EEEEEE" : $color="#CCCCCC") . "\"><th align=\"left\">" . $query_text . "</th></tr>";
}
if ($dump_tables)
{
$query_text = "mysqldump -h\"" . $host . "\" -u\"" . $user . "\" -p\"" . $password . "\" " . $database . " ";
foreach ($dump_tables as $key => $value)
{
$query_text .= $value . " ";
}
$query_text .= "> " . $dumppath;
if (!system($query_text))
{
echo "<tr bgcolor=\"" . (($row++ % 2 == 1) ? $color="#EEEEEE" : $color="#CCCCCC") . "\"><th align=\"left\">DUMPED DATABASE: " . $database. "</th></tr>";
}
chmod($dumppath, 0660);
}
for ($i = 0; $i < count($empty_tables); $i++)
{
$query_text = "DELETE FROM " . $database . "." . $empty_tables[$i];
@mysql_db_query($database, $query_text, $db_link) or mysql_client_error_msg($query_text, __FILE__, __LINE__);
echo "<tr bgcolor=\"" . (($row++ % 2 == 1) ? $color="#EEEEEE" : $color="#CCCCCC") . "\"><th align=\"left\">EMPTIED TABLE: " . $database . "." . $empty_tables[$i] . "</th></tr>";
}
for ($i = 0; $i < count($drop_tables); $i++)
{
$query_text = "DROP TABLE " . $database . "." . $drop_tables[$i];
@mysql_db_query($database, $query_text, $db_link) or mysql_client_error_msg($query_text, __FILE__, __LINE__);
echo "<tr bgcolor=\"" . (($row++ % 2 == 1) ? $color="#EEEEEE" : $color="#CCCCCC") . "\"><th align=\"left\">DROPPED TABLE: " . $database . "." . $drop_tables[$i] . "</th></tr>";
}
?>
</table>