if (isset($_POST["server"]) && $_POST["token"]) {
$_POST["token"] = $_SESSION["tokens"][$_GET["server"]];
}
+$token = $_SESSION["tokens"][$_GET["server"]]; ///< @var string CSRF protection
+$error = ($_POST ///< @var string
+ ? ($_POST["token"] == $token ? "" : lang('Invalid CSRF token. Send the form again.'))
+ : ($_SERVER["REQUEST_METHOD"] != "POST" ? "" : lang('Too big POST data. Reduce the data or increase the %s configuration directive.', '"post_max_size"')) // posted form with no data means that post_max_size exceeded because Adminer always sends token at least
+);
$on_actions = array("RESTRICT", "CASCADE", "SET NULL", "NO ACTION"); ///< @var array used in foreign_keys()
$confirm = " onclick=\"return confirm('" . lang('Are you sure?') . "');\""; ///< @var string
-$token = $_SESSION["tokens"][$_GET["server"]]; ///< @var string CSRF protection
-/** @var string */
-$error = ($_POST
- ? ($_POST["token"] == $token ? "" : lang('Invalid CSRF token. Send the form again.'))
- : ($_SERVER["REQUEST_METHOD"] != "POST" ? "" : lang('Too big POST data. Reduce the data or increase the %s configuration directive.', '"post_max_size"')) // posted form with no data means that post_max_size exceeded because Adminer always sends token at least
-);
queries_redirect(substr(ME, 0, -1), lang('Database has been dropped.'), !$connection->error);
}
- page_header(lang('Select database'), "", null);
+ page_header(lang('Select database'), $error, null);
echo "<p>";
foreach (array(
'database' => lang('Create new database'),
echo "<thead><tr><td><input type='hidden' name='token' value='$token'> <th>" . lang('Database') . "<td>" . lang('Collation') . "</thead>\n";
foreach ($databases as $db) {
$root = h(ME) . "db=" . urlencode($db);
- echo "<tr" . odd() . "><td>" . checkbox("db[]", $db, false);
+ echo "<tr" . odd() . "><td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"]));
echo "<th><a href='$root'>" . h($db) . "</a>";
echo "<td><a href='$root&database='>" . nbsp(db_collation($db, $collations)) . "</a>";
echo "\n";