diff --git a/abstraction.inc.php b/abstraction.inc.php index 96bf2b2d..400d6934 100644 --- a/abstraction.inc.php +++ b/abstraction.inc.php @@ -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()")); diff --git a/auth.inc.php b/auth.inc.php index d737568f..e1cef529 100644 --- a/auth.inc.php +++ b/auth.inc.php @@ -1,5 +1,5 @@
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; } diff --git a/design.inc.php b/design.inc.php index f12498c2..866cc392 100644 --- a/design.inc.php +++ b/design.inc.php @@ -9,7 +9,7 @@ function page_header($title, $breadcrumb = array(), $title2 = "") { -