<?PHP
require "login.php";
if ($currentgroup != "admin") { Header("Location:index.php"); }
function showTable($tablename) {
$r = qDB("describe $tablename");
?>
<font face="<?PHP echo $pageFont ?>" size="+<?PHP echo ($pageFontsize+3) ?>">
<?PHP echo $tablename ?>
</font>
<table border="0" cellpadding="5" width="100%">
<tr>
<?PHP
for ($x = 1; $x <= mysql_num_rows($r); $x++) {
$d = mysql_fetch_array($r);
if (gettype($d[0]) == "string") { ?>
<td id="bordered" align="center" bgcolor="<?PHP echo $GLOBALS["medBackCol"] ?>"><font face="<?PHP echo $GLOBALS["pageFont"] ?>" size="<?PHP echo $GLOBALS["pageFontsize"] ?>" color="<?PHP echo $GLOBALS["medForeCol"] ?>"><strong><?PHP echo $d[0] ?></strong></font></td>
<?PHP }
}
?>
</tr>
<?PHP
$r = qDB("SELECT * from $tablename");
for ($x = 1; $x <= mysql_num_rows($r); $x++) {
while ($d = mysql_fetch_array($r)) {
?>
<tr>
<?PHP
while(list($one, $two) = each($d)) {
if (gettype($one) == "string") { ?>
<td id="bordered" align="center"><font face="<?PHP echo $GLOBALS["pageFont"] ?>" size="<?PHP echo $GLOBALS["pageFontsize"] ?>" color="<?PHP echo $GLOBALS["pageForeCol"] ?>"><?PHP echo $two ?></td>
<?PHP }
}
?>
</tr>
<?PHP
}
}
?>
</table>
<?PHP
}
if ($query) { $query = str_replace("\\","",$query); $r = qDB($query); }
$currentPage = "STD->admin->table dump";
require "header.php";
if (mysql_errno() > 0) { echo "Oops! There was an error of ".mysql_errno()." while trying to perform this query"; }
?>
<form action="tabledump.php" method="post">
<input type="text" size="45" name="query" value="<?PHP echo str_replace("'","",$query) ?>">
<input type="submit" value="Query">
</form>
<?PHP
$r = qDB("show tables");
for ($x = 1; $x <= mysql_num_rows($r); $x++) {
$d = mysql_fetch_array($r);
showTable($d[0]);
echo "<br><p></p>\n";
}
require "footer.php";
?>