<?php

include("postget.php");
include_once("common.php");
$pagetitle = _TABLES;

checklevel(4, $_REQUEST['clientid']);

include("head_template.php");
echo '
<div class="container">
	<div class="row">

';


$tables = mysql_list_tables($db__name);

$tablelist = '';
$num_rows = mysql_num_rows($tables);
for ($i = 0; $i < $num_rows; $i++) {
    $tablelist .= mysql_tablename($tables, $i);
    if ($i < $num_rows - 1) {
        $tablelist .= ", ";
    }
}


print ("<table class='table table-striped'>
<thead><tr>
<th>" . _TABLES . "</th><th>" . _STATUS . "</th>
</tr></thead><tbody>
");

if ($option == "check") {
    $text = mysql_query("CHECK TABLE $tablelist");
} elseif ($option == "analyze") {
    $text = mysql_query("ANALYZE TABLE $tablelist");
} elseif ($option == "repair") {
    $text = mysql_query("REPAIR TABLE $tablelist");
} elseif ($option == "optimize") {
    $text = mysql_query("OPTIMIZE TABLE $tablelist");
}

while ($row = mysql_fetch_array($text)) {
    echo '<tr>';
    print ("<td>" . $row[0] . "</td><td align='center'><b>" . $row[3] . "</b></td>");
    print ("</tr>");
}

print ("</tbody></table>");
echo '
</div>
</div>
';

include("foot_template.php");
?>