SHOW DATABASES can be revoked

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@506 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2008-09-30 12:00:18 +00:00
parent 766caa4ddc
commit 49f7886f41
3 changed files with 15 additions and 10 deletions

View file

@ -76,16 +76,18 @@ function page_footer($missing = false) {
</form>
<form action="">
<p><?php if (strlen($_GET["server"])) { ?><input type="hidden" name="server" value="<?php echo htmlspecialchars($_GET["server"]); ?>" /><?php } ?>
<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)</option>
<?php
echo optionlist(get_databases(), $_GET["db"]);
?>
</select>
<?php if (get_databases()) { ?>
<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)</option><?php echo optionlist(get_databases(), $_GET["db"]); ?></select>
<?php } else { ?>
<input name="db" value="<?php echo htmlspecialchars($_GET["db"]); ?>" /> <input type="submit" value="<?php echo lang('Use'); ?>" />
<?php } ?>
<?php if (isset($_GET["sql"])) { ?><input type="hidden" name="sql" value="" /><?php } ?>
<?php if (isset($_GET["schema"])) { ?><input type="hidden" name="schema" value="" /><?php } ?>
<?php if (isset($_GET["dump"])) { ?><input type="hidden" name="dump" value="" /><?php } ?>
</p>
<?php if (get_databases()) { ?>
<noscript><p><input type="submit" value="<?php echo lang('Use'); ?>" /></p></noscript>
<?php } ?>
</form>
<?php
if ($missing != "db" && strlen($_GET["db"])) {

View file

@ -31,12 +31,14 @@ function optionlist($options, $selected = array()) {
function get_vals($query) {
global $mysql;
$result = $mysql->query($query);
$return = array();
while ($row = $result->fetch_row()) {
$return[] = $row[0];
$result = $mysql->query($query);
if ($result) {
while ($row = $result->fetch_row()) {
$return[] = $row[0];
}
$result->free();
}
$result->free();
return $return;
}

View file

@ -166,7 +166,8 @@ if (isset($_GET["download"])) {
}
echo "</table>\n";
echo "<p><input type='hidden' name='token' value='$token' /><input type='submit' value='" . lang('Analyze') . "' /> <input type='submit' name='optimize' value='" . lang('Optimize') . "' /> <input type='submit' name='check' value='" . lang('Check') . "' /> <input type='submit' name='repair' value='" . lang('Repair') . "' /> <input type='submit' name='truncate' value='" . lang('Truncate') . "' onclick=\"return confirm('" . lang('Are you sure?') . "');\" /> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . "');\" /></p>\n";
echo "<p>" . lang('Move to other database') . ": <select name='target'>" . optionlist(get_databases(), (isset($_POST["target"]) ? $_POST["target"] : $_GET["db"])) . "</select> <input type='submit' name='move' value='" . lang('Move') . "' /></p>\n";
$db = (isset($_POST["target"]) ? $_POST["target"] : $_GET["db"]);
echo "<p>" . lang('Move to other database') . (get_databases() ? ": <select name='target'>" . optionlist(get_databases(), $db) . "</select>" : ': <input name="target" value="' . htmlspecialchars($db) . '" />') . " <input type='submit' name='move' value='" . lang('Move') . "' /></p>\n";
echo "</form>\n";
}
$result->free();