File upload on same URL
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@99 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
5be219fbd8
commit
98ccf0fd6c
|
@ -4,7 +4,7 @@
|
||||||
session_start();
|
session_start();
|
||||||
error_reporting(E_ALL & ~E_NOTICE);
|
error_reporting(E_ALL & ~E_NOTICE);
|
||||||
$SELF = preg_replace('~^[^?]*/([^?]*).*~', '\\1?', $_SERVER["REQUEST_URI"]) . (strlen($_GET["server"]) ? 'server=' . urlencode($_GET["server"]) . '&' : '') . (strlen($_GET["db"]) ? 'db=' . urlencode($_GET["db"]) . '&' : '');
|
$SELF = preg_replace('~^[^?]*/([^?]*).*~', '\\1?', $_SERVER["REQUEST_URI"]) . (strlen($_GET["server"]) ? 'server=' . urlencode($_GET["server"]) . '&' : '') . (strlen($_GET["db"]) ? 'db=' . urlencode($_GET["db"]) . '&' : '');
|
||||||
$TOKENS = &$_SESSION["tokens"][$_GET["server"]][preg_replace('~([?&]sql=)upload~', '\\1', $_SERVER["REQUEST_URI"])];
|
$TOKENS = &$_SESSION["tokens"][$_GET["server"]][$_SERVER["REQUEST_URI"]];
|
||||||
include "./functions.inc.php";
|
include "./functions.inc.php";
|
||||||
include "./lang.inc.php";
|
include "./lang.inc.php";
|
||||||
include "./design.inc.php";
|
include "./design.inc.php";
|
||||||
|
|
|
@ -38,12 +38,12 @@ if ($_POST && $error) {
|
||||||
if ($empty) {
|
if ($empty) {
|
||||||
echo "<p class='message'>" . lang('No commands to execute.') . "</p>\n";
|
echo "<p class='message'>" . lang('No commands to execute.') . "</p>\n";
|
||||||
}
|
}
|
||||||
} elseif ($_GET["sql"] == "upload") {
|
} elseif ($_POST) {
|
||||||
echo "<p class='error'>" . lang('Unable to upload a file.') . "</p>\n";
|
echo "<p class='error'>" . lang('Unable to upload a file.') . "</p>\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form action="<?php echo htmlspecialchars($SELF); ?>sql=" method="post">
|
<form action="" method="post">
|
||||||
<p><textarea name="query" rows="20" cols="80"><?php echo htmlspecialchars($_POST["query"]); ?></textarea></p>
|
<p><textarea name="query" rows="20" cols="80"><?php echo htmlspecialchars($_POST["query"]); ?></textarea></p>
|
||||||
<p><input type="hidden" name="token" value="<?php echo $token; ?>" /><input type="submit" value="<?php echo lang('Execute'); ?>" /></p>
|
<p><input type="hidden" name="token" value="<?php echo $token; ?>" /><input type="submit" value="<?php echo lang('Execute'); ?>" /></p>
|
||||||
</form>
|
</form>
|
||||||
|
@ -52,7 +52,7 @@ if ($_POST && $error) {
|
||||||
if (!ini_get("file_uploads")) {
|
if (!ini_get("file_uploads")) {
|
||||||
echo "<p>" . lang('File uploads are disabled.') . "</p>\n";
|
echo "<p>" . lang('File uploads are disabled.') . "</p>\n";
|
||||||
} else { ?>
|
} else { ?>
|
||||||
<form action="<?php echo htmlspecialchars($SELF); ?>sql=upload" method="post" enctype="multipart/form-data">
|
<form action="" method="post" enctype="multipart/form-data">
|
||||||
<p>
|
<p>
|
||||||
<?php echo lang('File upload'); ?>: <input type="file" name="sql_file" />
|
<?php echo lang('File upload'); ?>: <input type="file" name="sql_file" />
|
||||||
<input type="hidden" name="token" value="<?php echo $token; ?>" />
|
<input type="hidden" name="token" value="<?php echo $token; ?>" />
|
||||||
|
|
Loading…
Reference in a new issue