Connection port
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@357 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
794192d9c6
commit
a6e54b58ed
|
@ -5,11 +5,13 @@ if (extension_loaded("mysqli")) {
|
|||
$this->init();
|
||||
}
|
||||
|
||||
function connect($server, $username, $password) {
|
||||
function connect($server, $username, $password, $port) {
|
||||
return @$this->real_connect(
|
||||
(strlen($server) ? $server : ini_get("mysqli.default_host")),
|
||||
(strlen("$server$username") ? $username : ini_get("mysqli.default_user")),
|
||||
(strlen("$server$username$password") ? $password : ini_get("mysqli.default_pw"))
|
||||
(strlen("$server$username$password") ? $password : ini_get("mysqli.default_pw")),
|
||||
null,
|
||||
(strlen($port) ? $port : ini_get("mysqli.default_port"))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -25,9 +27,9 @@ if (extension_loaded("mysqli")) {
|
|||
class Min_MySQL {
|
||||
var $_link, $_result, $server_info, $affected_rows, $error;
|
||||
|
||||
function connect($server, $username, $password) {
|
||||
function connect($server, $username, $password, $port) {
|
||||
$this->_link = @mysql_connect(
|
||||
(strlen($server) ? $server : ini_get("mysql.default_host")),
|
||||
(strlen($server) ? $server : ini_get("mysql.default_host")) . (strlen($port) ? ":$port" : ""),
|
||||
(strlen("$server$username") ? $username : ini_get("mysql.default_user")),
|
||||
(strlen("$server$username$password") ? $password : ini_get("mysql.default_password")),
|
||||
131072 // CLIENT_MULTI_RESULTS for CALL
|
||||
|
@ -113,9 +115,9 @@ if (extension_loaded("mysqli")) {
|
|||
function __construct() {
|
||||
}
|
||||
|
||||
function connect($server, $username, $password) {
|
||||
function connect($server, $username, $password, $port) {
|
||||
set_exception_handler('auth_error'); // try/catch is not compatible with PHP 4
|
||||
parent::__construct("mysql:host=$server", $username, $password);
|
||||
parent::__construct("mysql:host=$server" . (strlen($port) ? ";port=$port" : ""), $username, $password);
|
||||
restore_exception_handler();
|
||||
$this->setAttribute(13, array('Min_PDOStatement')); // PDO::ATTR_STATEMENT_CLASS
|
||||
$this->server_info = $this->result($this->query("SELECT VERSION()"));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
$ignore = array("server", "username", "password");
|
||||
$ignore = array("server", "username", "password", "port");
|
||||
if (ini_get("session.use_trans_sid") && isset($_POST[session_name()])) {
|
||||
$ignore[] = session_name();
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ if (isset($_POST["server"])) {
|
|||
session_regenerate_id();
|
||||
$_SESSION["usernames"][$_POST["server"]] = $_POST["username"];
|
||||
$_SESSION["passwords"][$_POST["server"]] = $_POST["password"];
|
||||
$_SESSION["ports"][$_POST["server"]] = $_POST["port"];
|
||||
if (count($_POST) == count($ignore)) {
|
||||
if ((string) $_GET["server"] === $_POST["server"]) {
|
||||
$location = remove_from_uri();
|
||||
|
@ -25,6 +26,7 @@ if (isset($_POST["server"])) {
|
|||
} elseif (isset($_GET["logout"])) {
|
||||
unset($_SESSION["usernames"][$_GET["server"]]);
|
||||
unset($_SESSION["passwords"][$_GET["server"]]);
|
||||
unset($_SESSION["ports"][$_GET["server"]]);
|
||||
unset($_SESSION["databases"][$_GET["server"]]);
|
||||
$_SESSION["tokens"][$_GET["server"]] = array();
|
||||
redirect(substr($SELF, 0, -1), lang('Logout successful.'));
|
||||
|
@ -51,6 +53,7 @@ function auth_error() {
|
|||
<tr><th><?php echo lang('Server'); ?>:</th><td><input name="server" value="<?php echo htmlspecialchars($_GET["server"]); ?>" /></td></tr>
|
||||
<tr><th><?php echo lang('Username'); ?>:</th><td><input name="username" value="<?php echo htmlspecialchars($username); ?>" /></td></tr>
|
||||
<tr><th><?php echo lang('Password'); ?>:</th><td><input type="password" name="password" /></td></tr>
|
||||
<tr><th><?php echo lang('Port'); ?>:</th><td><input name="port" size="4" value="<?php echo htmlspecialchars($_SESSION["ports"][$_GET["server"]]); ?>" /></td></tr>
|
||||
</table>
|
||||
<p>
|
||||
<?php
|
||||
|
@ -76,7 +79,7 @@ function auth_error() {
|
|||
}
|
||||
|
||||
$username = $_SESSION["usernames"][$_GET["server"]];
|
||||
if (!isset($username) || !$mysql->connect($_GET["server"], $username, $_SESSION["passwords"][$_GET["server"]])) {
|
||||
if (!isset($username) || !$mysql->connect($_GET["server"], $username, $_SESSION["passwords"][$_GET["server"]], $_SESSION["ports"][$_GET["server"]])) {
|
||||
auth_error();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ function page_header($title, $breadcrumb = array(), $title2 = "") {
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
||||
<meta name="robots" content="noindex" />
|
||||
<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " 1.4.1-dev"; ?></title>
|
||||
<title><?php echo $title . (strlen($title2) ? ": " . htmlspecialchars($title2) : "") . " - " . lang('phpMinAdmin') . " 1.5.0-dev"; ?></title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="default.css" /><?php // Ondrej Valka, http://valka.info ?>
|
||||
<?php if ($_COOKIE["highlight"] == "jush") { ?>
|
||||
|
|
|
@ -162,4 +162,5 @@ $translations = array(
|
|||
'Routine' => 'Procedura',
|
||||
'Grant' => 'Povolit',
|
||||
'Revoke' => 'Zakázat',
|
||||
'Port' => 'Port',
|
||||
);
|
||||
|
|
|
@ -162,4 +162,5 @@ $translations = array(
|
|||
'Routine' => 'Routine',
|
||||
'Grant' => 'Toekennen',
|
||||
'Revoke' => 'Intrekken',
|
||||
'Port' => 'Poort',
|
||||
);
|
||||
|
|
|
@ -162,4 +162,5 @@ $translations = array(
|
|||
'Routine' => 'Procedúra',
|
||||
'Grant' => 'Povoliť',
|
||||
'Revoke' => 'Zakázať',
|
||||
'Port' => 'Port',
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue