2007-07-02 05:51:26 +00:00
|
|
|
<?php
|
2009-05-29 20:30:16 +00:00
|
|
|
function connect_error() {
|
2010-10-13 15:53:59 +00:00
|
|
|
global $connection, $token, $error, $drivers;
|
2010-04-21 12:01:32 +00:00
|
|
|
$databases = array();
|
2010-01-09 23:33:41 +00:00
|
|
|
if (DB != "") {
|
2010-04-21 12:01:32 +00:00
|
|
|
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
|
2007-07-02 20:21:30 +00:00
|
|
|
} else {
|
2009-10-18 09:29:01 +00:00
|
|
|
if ($_POST["db"] && !$error) {
|
2010-04-23 09:05:30 +00:00
|
|
|
queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"]));
|
2009-10-18 09:29:01 +00:00
|
|
|
}
|
|
|
|
|
2010-04-21 12:01:32 +00:00
|
|
|
page_header(lang('Select database'), $error, false);
|
|
|
|
echo "<p><a href='" . h(ME) . "database='>" . lang('Create new database') . "</a>\n";
|
2009-06-21 23:35:27 +00:00
|
|
|
foreach (array(
|
|
|
|
'privileges' => lang('Privileges'),
|
|
|
|
'processlist' => lang('Process list'),
|
|
|
|
'variables' => lang('Variables'),
|
2010-01-08 10:07:08 +00:00
|
|
|
'status' => lang('Status'),
|
2009-06-21 23:35:27 +00:00
|
|
|
) as $key => $val) {
|
2010-04-21 12:01:32 +00:00
|
|
|
if (support($key)) {
|
|
|
|
echo "<a href='" . h(ME) . "$key='>$val</a>\n";
|
|
|
|
}
|
2009-06-21 23:35:27 +00:00
|
|
|
}
|
2010-04-21 12:01:32 +00:00
|
|
|
echo "<p>" . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>$connection->server_info</b>", "<b>$connection->extension</b>") . "\n";
|
|
|
|
echo "<p>" . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n";
|
2009-10-18 09:29:01 +00:00
|
|
|
$databases = get_databases();
|
|
|
|
if ($databases) {
|
|
|
|
$collations = collations();
|
|
|
|
echo "<form action='' method='post'>\n";
|
2009-12-17 13:22:28 +00:00
|
|
|
echo "<table cellspacing='0' onclick='tableClick(event);'>\n";
|
2010-04-21 12:01:32 +00:00
|
|
|
echo "<thead><tr><td><input type='hidden' name='token' value='$token'> <th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\n";
|
2009-10-18 09:29:01 +00:00
|
|
|
foreach ($databases as $db) {
|
|
|
|
$root = h(ME) . "db=" . urlencode($db);
|
2010-02-26 14:01:17 +00:00
|
|
|
echo "<tr" . odd() . "><td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"]));
|
2009-10-18 09:29:01 +00:00
|
|
|
echo "<th><a href='$root'>" . h($db) . "</a>";
|
|
|
|
echo "<td><a href='$root&database='>" . nbsp(db_collation($db, $collations)) . "</a>";
|
2010-04-21 12:01:32 +00:00
|
|
|
echo "<td align='right'><a href='$root&schema=' id='tables-" . h($db) . "'>?</a>";
|
2009-10-18 09:29:01 +00:00
|
|
|
echo "\n";
|
|
|
|
}
|
|
|
|
echo "</table>\n";
|
2009-12-17 13:22:28 +00:00
|
|
|
echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /db/) + ')');\">\n";
|
2009-10-18 09:29:01 +00:00
|
|
|
echo "</form>\n";
|
|
|
|
}
|
2007-07-02 05:51:26 +00:00
|
|
|
}
|
2007-07-06 08:47:20 +00:00
|
|
|
page_footer("db");
|
2010-10-17 23:20:02 +00:00
|
|
|
echo "<script type='text/javascript' src='" . h(ME . "script=connect&token=$token") . "'></script>\n";
|
2009-05-29 20:30:16 +00:00
|
|
|
}
|
|
|
|
|
2010-01-08 10:07:08 +00:00
|
|
|
if (isset($_GET["status"])) {
|
|
|
|
$_GET["variables"] = $_GET["status"];
|
|
|
|
}
|
2010-10-15 09:26:42 +00:00
|
|
|
if (!(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"]) || $_GET["script"] == "connect")) {
|
2010-01-09 23:33:41 +00:00
|
|
|
if (DB != "") {
|
2010-10-15 08:58:08 +00:00
|
|
|
set_session("dbs", null);
|
2009-05-29 20:30:16 +00:00
|
|
|
}
|
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;
|
|
|
|
}
|
2010-05-05 16:30:55 +00:00
|
|
|
|
|
|
|
if (support("scheme") && DB != "" && $_GET["ns"] !== "" && (!isset($_GET["ns"]) || !set_schema($_GET["ns"]))) {
|
|
|
|
redirect(preg_replace('~ns=[^&]*&~', '', ME) . "ns=" . get_schema());
|
|
|
|
}
|