2009-07-03 05:16:39 +00:00
|
|
|
<?php
|
2009-08-25 16:29:59 +00:00
|
|
|
error_reporting(6135); // errors and warnings
|
2009-07-03 05:16:39 +00:00
|
|
|
|
2009-07-24 15:50:35 +00:00
|
|
|
include "../adminer/include/coverage.inc.php";
|
|
|
|
|
2009-07-03 05:16:39 +00:00
|
|
|
// disable filter.default
|
2009-07-03 10:10:40 +00:00
|
|
|
$filter = (!ereg('^(unsafe_raw)?$', ini_get("filter.default")) || ini_get("filter.default_flags"));
|
2009-07-03 05:16:39 +00:00
|
|
|
if ($filter) {
|
2009-07-03 10:10:40 +00:00
|
|
|
foreach (array('_GET', '_POST', '_COOKIE', '_SERVER') as $val) {
|
|
|
|
$unsafe = filter_input_array(constant("INPUT$val"), FILTER_UNSAFE_RAW);
|
|
|
|
if ($unsafe) {
|
|
|
|
$$val = $unsafe;
|
|
|
|
}
|
|
|
|
}
|
2009-07-03 05:16:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// used only in compiled file
|
|
|
|
if (isset($_GET["file"])) {
|
2010-04-23 20:18:00 +00:00
|
|
|
include "../adminer/file.inc.php";
|
2009-07-03 05:16:39 +00:00
|
|
|
}
|
|
|
|
|
2010-04-21 12:01:32 +00:00
|
|
|
include "../adminer/include/functions.inc.php";
|
|
|
|
|
2009-07-30 08:12:54 +00:00
|
|
|
if (!isset($_SERVER["REQUEST_URI"])) {
|
2010-04-21 12:01:32 +00:00
|
|
|
$_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"] . ($_SERVER["QUERY_STRING"] != "" ? "?$_SERVER[QUERY_STRING]" : ""); // IIS 5 compatibility
|
2009-07-30 08:12:54 +00:00
|
|
|
}
|
2010-05-25 09:39:13 +00:00
|
|
|
$HTTPS = $_SERVER["HTTPS"] && strcasecmp($_SERVER["HTTPS"], "off");
|
2009-07-30 08:12:54 +00:00
|
|
|
|
2009-11-02 21:10:27 +00:00
|
|
|
@ini_set("session.use_trans_sid", false); // protect links in export, @ - may be disabled
|
2010-10-09 13:39:57 +00:00
|
|
|
if (!defined("SID")) {
|
2010-04-02 13:25:49 +00:00
|
|
|
session_name("adminer_sid"); // use specific session name to get own namespace
|
2010-05-25 09:39:13 +00:00
|
|
|
$params = array(0, preg_replace('~\\?.*~', '', $_SERVER["REQUEST_URI"]), "", $HTTPS);
|
2010-04-02 13:25:49 +00:00
|
|
|
if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
|
|
|
|
$params[] = true; // HttpOnly
|
|
|
|
}
|
|
|
|
call_user_func_array('session_set_cookie_params', $params); // ini_set() may be disabled
|
|
|
|
session_start();
|
2009-07-03 05:16:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// disable magic quotes to be able to use database escaping function
|
2010-07-26 12:47:26 +00:00
|
|
|
remove_slashes(array(&$_GET, &$_POST, &$_COOKIE));
|
2009-09-14 15:12:51 +00:00
|
|
|
if (function_exists("set_magic_quotes_runtime")) {
|
|
|
|
set_magic_quotes_runtime(false);
|
|
|
|
}
|
2009-08-25 12:11:12 +00:00
|
|
|
@set_time_limit(0); // @ - can be disabled
|
2010-10-18 21:09:26 +00:00
|
|
|
@ini_set("zend.ze1_compatibility_mode", false); // @ - deprecated
|
2009-07-03 06:26:01 +00:00
|
|
|
|
2010-04-21 12:01:32 +00:00
|
|
|
include "../adminer/include/lang.inc.php";
|
|
|
|
include "../adminer/lang/$LANG.inc.php";
|
|
|
|
include "../adminer/include/pdo.inc.php";
|
|
|
|
include "../adminer/drivers/sqlite.inc.php";
|
|
|
|
include "../adminer/drivers/pgsql.inc.php";
|
2010-05-14 16:37:06 +00:00
|
|
|
include "../adminer/drivers/oracle.inc.php";
|
2010-04-21 12:01:32 +00:00
|
|
|
include "../adminer/drivers/mssql.inc.php";
|
|
|
|
include "../adminer/drivers/mysql.inc.php"; // must be included as last driver
|
2010-02-24 12:00:31 +00:00
|
|
|
|
2010-04-21 12:01:32 +00:00
|
|
|
define("SERVER", $_GET[DRIVER]); // read from pgsql=localhost
|
2009-08-29 13:54:25 +00:00
|
|
|
define("DB", $_GET["db"]); // for the sake of speed and size
|
2010-04-21 12:01:32 +00:00
|
|
|
define("ME", preg_replace('~^[^?]*/([^?]*).*~', '\\1', $_SERVER["REQUEST_URI"]) . '?'
|
|
|
|
. (SID && !$_COOKIE ? SID . '&' : '') // !$_COOKIE - don't pass SID with permanent login
|
|
|
|
. (SERVER !== null ? DRIVER . "=" . urlencode(SERVER) . '&' : '')
|
|
|
|
. (isset($_GET["username"]) ? "username=" . urlencode($_GET["username"]) . '&' : '')
|
2010-05-05 16:30:55 +00:00
|
|
|
. (DB != "" ? 'db=' . urlencode(DB) . '&' . (isset($_GET["ns"]) ? "ns=" . urlencode($_GET["ns"]) . "&" : "") : '')
|
2010-04-21 12:01:32 +00:00
|
|
|
);
|
2009-07-11 19:45:57 +00:00
|
|
|
|
2010-04-21 12:01:32 +00:00
|
|
|
include "../adminer/include/version.inc.php";
|
2009-07-11 19:45:57 +00:00
|
|
|
include "./include/adminer.inc.php";
|
|
|
|
include "../adminer/include/design.inc.php";
|
2010-01-08 17:12:03 +00:00
|
|
|
include "../adminer/include/xxtea.inc.php";
|
2009-07-21 12:19:25 +00:00
|
|
|
include "../adminer/include/auth.inc.php";
|
2009-07-11 19:45:57 +00:00
|
|
|
include "./include/connect.inc.php";
|
|
|
|
include "./include/editing.inc.php";
|
|
|
|
include "./include/export.inc.php";
|
2009-07-16 14:06:33 +00:00
|
|
|
|
2009-11-02 22:09:23 +00:00
|
|
|
session_cache_limiter(""); // to allow restarting session
|
2010-04-21 12:01:32 +00:00
|
|
|
if (!ini_bool("session.use_cookies") || @ini_set("session.use_cookies", false) !== false) { // @ - may be disabled
|
2009-11-03 10:55:57 +00:00
|
|
|
session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
|
2009-11-02 22:09:23 +00:00
|
|
|
}
|
|
|
|
|
2009-12-18 15:36:57 +00:00
|
|
|
$on_actions = array("RESTRICT", "CASCADE", "SET NULL", "NO ACTION"); ///< @var array used in foreign_keys()
|