From 84d7838e130daecde29bc531afe0803cb6701bb8 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Tue, 9 Aug 2016 15:37:45 +0100 Subject: [PATCH] Allow setting of alternative MySQL port --- Plugins/Mineplex.ReportSite/view.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.ReportSite/view.php b/Plugins/Mineplex.ReportSite/view.php index f071026d2..29dc75b6c 100644 --- a/Plugins/Mineplex.ReportSite/view.php +++ b/Plugins/Mineplex.ReportSite/view.php @@ -41,13 +41,24 @@ $fullUrl = $parts[1]; $urlParts = explode('/', $fullUrl); $host = $urlParts[0]; + $port = 3306; + + // check is port has been declared + if (strpos($host, ':') !== false) + { + $hostParts = explode(':', $host); + $host = $hostParts[0]; + $port = $hostParts[1]; + } + $database = $urlParts[1]; $name = $parts[0]; $username = $parts[2]; $password = $parts[3]; - $connection = new mysqli($host, $username, $password, $database); + echo $port; + $connection = new mysqli($host, $username, $password, $database, $port); if ($connection->connect_error) { die("Connection \"$name\" failed: $connection->connect_error");