2007-07-02 05:51:26 +00:00
|
|
|
<?php
|
2009-05-29 20:30:16 +00:00
|
|
|
function connect_error() {
|
2009-10-18 09:29:01 +00:00
|
|
|
global $connection, $VERSION, $token, $error;
|
2009-08-29 13:54:25 +00:00
|
|
|
if (strlen(DB)) {
|
|
|
|
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), false);
|
2007-07-02 20:21:30 +00:00
|
|
|
} else {
|
2009-10-18 09:29:01 +00:00
|
|
|
if ($_POST["db"] && !$error) {
|
|
|
|
unset($_SESSION["databases"][$_GET["server"]]);
|
|
|
|
foreach ($_POST["db"] as $db) {
|
|
|
|
if (!queries("DROP DATABASE " . idf_escape($db))) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
queries_redirect(substr(ME, 0, -1), lang('Database has been dropped.'), !$connection->error);
|
|
|
|
}
|
|
|
|
|
2008-04-10 14:37:10 +00:00
|
|
|
page_header(lang('Select database'), "", null);
|
2009-10-18 09:29:01 +00:00
|
|
|
echo "<p>";
|
2009-06-21 23:35:27 +00:00
|
|
|
foreach (array(
|
|
|
|
'database' => lang('Create new database'),
|
|
|
|
'privileges' => lang('Privileges'),
|
|
|
|
'processlist' => lang('Process list'),
|
|
|
|
'variables' => lang('Variables'),
|
|
|
|
) as $key => $val) {
|
2009-10-18 09:29:01 +00:00
|
|
|
echo "<a href='" . h(ME) . "$key='>$val</a>\n";
|
2009-06-21 23:35:27 +00:00
|
|
|
}
|
2009-09-22 10:51:40 +00:00
|
|
|
echo "<p>" . lang('MySQL version: %s through PHP extension %s', "<b" . ($connection->server_info < 4.1 ? " class='binary'" : "") . ">$connection->server_info</b>", "<b>$connection->extension</b>") . "\n";
|
|
|
|
echo "<p>" . lang('Logged as: %s', "<b>" . h($connection->result($connection->query("SELECT USER()"))) . "</b>") . "\n";
|
2009-10-18 09:29:01 +00:00
|
|
|
$databases = get_databases();
|
|
|
|
if ($databases) {
|
|
|
|
$collations = collations();
|
|
|
|
echo "<form action='' method='post'>\n";
|
|
|
|
echo "<table cellspacing='0' onclick='table_click(event);'>\n";
|
|
|
|
echo "<thead><tr><td><input type='hidden' name='token' value='$token'> <th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\n";
|
|
|
|
foreach ($databases as $db) {
|
|
|
|
$root = h(ME) . "db=" . urlencode($db);
|
|
|
|
echo "<tr><td>" . checkbox("db[]", $db, false);
|
|
|
|
echo "<th><a href='$root'>" . h($db) . "</a>";
|
|
|
|
echo "<td><a href='$root&database='>" . nbsp(db_collation($db, $collations)) . "</a>";
|
|
|
|
$result = $connection->query("SHOW TABLES FROM " . idf_escape($db));
|
2009-10-19 12:54:15 +00:00
|
|
|
echo "<td align='right'><a href='$root&schema='>$result->num_rows</a>";
|
2009-10-18 09:29:01 +00:00
|
|
|
echo "\n";
|
|
|
|
}
|
|
|
|
echo "</table>\n";
|
|
|
|
echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + form_checked(this, /db/) + ')');\">\n";
|
|
|
|
echo "</form>\n";
|
|
|
|
}
|
2007-07-02 05:51:26 +00:00
|
|
|
}
|
2007-07-06 08:47:20 +00:00
|
|
|
page_footer("db");
|
2009-05-29 20:30:16 +00:00
|
|
|
}
|
|
|
|
|
2009-09-22 10:51:40 +00:00
|
|
|
if (!(strlen(DB) ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET["dump"]) || isset($_GET["database"]) || isset($_GET["processlist"]) || isset($_GET["privileges"]) || isset($_GET["user"]) || isset($_GET["variables"]))) {
|
2009-08-29 13:54:25 +00:00
|
|
|
if (strlen(DB)) {
|
2009-05-29 20:30:16 +00:00
|
|
|
unset($_SESSION["databases"][$_GET["server"]]);
|
|
|
|
}
|
2009-06-21 23:20:32 +00:00
|
|
|
connect_error(); // separate function to catch SQLite error
|
2007-07-02 05:51:26 +00:00
|
|
|
exit;
|
|
|
|
}
|