mirror of
https://github.com/vrana/adminer.git
synced 2025-08-15 02:54:28 +02:00
remove_from_uri()
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@277 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -10,7 +10,7 @@ if (isset($_POST["server"])) {
|
|||||||
$_SESSION["passwords"][$_POST["server"]] = $_POST["password"];
|
$_SESSION["passwords"][$_POST["server"]] = $_POST["password"];
|
||||||
if (count($_POST) == count($ignore)) {
|
if (count($_POST) == count($ignore)) {
|
||||||
if ((string) $_GET["server"] === $_POST["server"]) {
|
if ((string) $_GET["server"] === $_POST["server"]) {
|
||||||
$location = preg_replace('~(\\?)' . urlencode(session_name()) . '=[^&]*&|[&?]' . urlencode(session_name()) . '=[^&]*~', '\\1', $_SERVER["REQUEST_URI"]);
|
$location = remove_from_uri();
|
||||||
} else {
|
} else {
|
||||||
$location = preg_replace('~^[^?]*/([^?]*).*~', '\\1', $_SERVER["REQUEST_URI"]) . (strlen($_POST["server"]) ? '?server=' . urlencode($_POST["server"]) : '');
|
$location = preg_replace('~^[^?]*/([^?]*).*~', '\\1', $_SERVER["REQUEST_URI"]) . (strlen($_POST["server"]) ? '?server=' . urlencode($_POST["server"]) : '');
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@ if ($_POST && !$error) {
|
|||||||
if ($mysql->query("CREATE DATABASE " . idf_escape($_POST["name"]) . ($_POST["collation"] ? " COLLATE '" . $mysql->escape_string($_POST["collation"]) . "'" : ""))) {
|
if ($mysql->query("CREATE DATABASE " . idf_escape($_POST["name"]) . ($_POST["collation"] ? " COLLATE '" . $mysql->escape_string($_POST["collation"]) . "'" : ""))) {
|
||||||
unset($_SESSION["databases"][$_GET["server"]]);
|
unset($_SESSION["databases"][$_GET["server"]]);
|
||||||
if (!strlen($_GET["db"])) {
|
if (!strlen($_GET["db"])) {
|
||||||
redirect(preg_replace('~db=[^&]*&~', '', $SELF) . "db=" . urlencode($_POST["name"]), lang('Database has been created.'));
|
redirect($SELF . "db=" . urlencode($_POST["name"]), lang('Database has been created.'));
|
||||||
}
|
}
|
||||||
$result = $mysql->query("SHOW TABLES");
|
$result = $mysql->query("SHOW TABLES");
|
||||||
while ($row = $result->fetch_row()) {
|
while ($row = $result->fetch_row()) {
|
||||||
|
@@ -193,6 +193,13 @@ function redirect($location, $message = null) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remove_from_uri($param = "") {
|
||||||
|
if (!isset($_COOKIE[session_name()])) {
|
||||||
|
$param = "($param|" . session_name() . ")";
|
||||||
|
}
|
||||||
|
return preg_replace("~\\?$param=[^&]*&~", '?', preg_replace("~\\?$param=[^&]*\$|&$param=[^&]*~", '', $_SERVER["REQUEST_URI"]));
|
||||||
|
}
|
||||||
|
|
||||||
function get_file($key) {
|
function get_file($key) {
|
||||||
if (isset($_POST["files"][$key])) {
|
if (isset($_POST["files"][$key])) {
|
||||||
$length = strlen($_POST["files"][$key]);
|
$length = strlen($_POST["files"][$key]);
|
||||||
|
@@ -24,7 +24,7 @@ function lang($idf, $number = null) {
|
|||||||
function switch_lang() {
|
function switch_lang() {
|
||||||
global $translations;
|
global $translations;
|
||||||
echo "<p>" . lang('Language') . ":";
|
echo "<p>" . lang('Language') . ":";
|
||||||
$base = preg_replace('~(\\?)lang=[^&]*&|[&?]lang=[^&]*~', '\\1', $_SERVER["REQUEST_URI"]);
|
$base = remove_from_uri("lang");
|
||||||
foreach ($translations as $lang => $val) {
|
foreach ($translations as $lang => $val) {
|
||||||
echo ' <a href="' . htmlspecialchars($base . (strpos($base, "?") !== false ? "&" : "?")) . "lang=$lang\">$lang</a>";
|
echo ' <a href="' . htmlspecialchars($base . (strpos($base, "?") !== false ? "&" : "?")) . "lang=$lang\">$lang</a>";
|
||||||
}
|
}
|
||||||
|
@@ -176,7 +176,7 @@ function add_row(field) {
|
|||||||
if (intval($limit) && $found_rows > $limit) {
|
if (intval($limit) && $found_rows > $limit) {
|
||||||
$max_page = floor($found_rows / $limit);
|
$max_page = floor($found_rows / $limit);
|
||||||
function print_page($page) {
|
function print_page($page) {
|
||||||
echo " " . ($page == $_GET["page"] ? $page + 1 : '<a href="' . htmlspecialchars(preg_replace('~(\\?)page=[^&]*&|&page=[^&]*~', '\\1', $_SERVER["REQUEST_URI"]) . ($page ? "&page=$page" : "")) . '">' . ($page + 1) . "</a>");
|
echo " " . ($page == $_GET["page"] ? $page + 1 : '<a href="' . htmlspecialchars(remove_from_uri("page") . ($page ? "&page=$page" : "")) . '">' . ($page + 1) . "</a>");
|
||||||
}
|
}
|
||||||
echo "<p>" . lang('Page') . ":";
|
echo "<p>" . lang('Page') . ":";
|
||||||
print_page(0);
|
print_page(0);
|
||||||
|
Reference in New Issue
Block a user