Allow alternate SQL port

ryzomclassic-develop
kaetemi 4 years ago
parent f9b7dbd4cb
commit 3f0bacd374
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

1
.gitignore vendored

@ -264,6 +264,7 @@ web/public_php/db_version_tool
web/public_php/db_version_web web/public_php/db_version_web
web/public_php/role_service web/public_php/role_service
web/public_php/role_support web/public_php/role_support
web/public_php/role_admin
web/public_php/role_domain web/public_php/role_domain
web/public_php/db_version_ring web/public_php/db_version_ring
web/public_php/config_user.php web/public_php/config_user.php

@ -25,7 +25,7 @@
require_once(NELTOOL_SYSTEMBASE. 'nel/admin_modules_itf.php'); require_once(NELTOOL_SYSTEMBASE. 'nel/admin_modules_itf.php');
// lets set up the database // lets set up the database
$db = new sql_db(NELTOOL_DBHOST, NELTOOL_DBUSER, NELTOOL_DBPASS, NELTOOL_DBNAME); $db = new sql_db(NELTOOL_DBHOST, NELTOOL_DBPORT, NELTOOL_DBUSER, NELTOOL_DBPASS, NELTOOL_DBNAME);
if (!is_object($db)) die("error on db init"); if (!is_object($db)) die("error on db init");
// lets set up the smarty template engine // lets set up the smarty template engine

@ -6,6 +6,7 @@
// database information for nel tool // database information for nel tool
define('NELTOOL_DBHOST', $cfg['db']['tool']['host']); define('NELTOOL_DBHOST', $cfg['db']['tool']['host']);
define('NELTOOL_DBPORT', $cfg['db']['tool']['port']);
define('NELTOOL_DBUSER', $cfg['db']['tool']['user']); define('NELTOOL_DBUSER', $cfg['db']['tool']['user']);
define('NELTOOL_DBPASS', $cfg['db']['tool']['pass']); define('NELTOOL_DBPASS', $cfg['db']['tool']['pass']);
define('NELTOOL_DBNAME', $cfg['db']['tool']['name']); define('NELTOOL_DBNAME', $cfg['db']['tool']['name']);

@ -41,13 +41,14 @@ class sql_db
// //
// Constructor // Constructor
// //
function __construct($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true) function __construct($sqlserver, $sqlport, $sqluser, $sqlpassword, $database, $persistency = true)
{ {
$this->persistency = $persistency; $this->persistency = $persistency;
$this->user = $sqluser; $this->user = $sqluser;
$this->password = $sqlpassword; $this->password = $sqlpassword;
$this->server = $sqlserver; $this->server = $sqlserver;
$this->port = $sqlport;
$this->dbname = $database; $this->dbname = $database;
if($this->persistency) if($this->persistency)
@ -55,7 +56,7 @@ class sql_db
$this->server = 'p:'.$this->server; $this->server = 'p:'.$this->server;
} }
$this->db_connect_id = mysqli_connect($this->server, $this->user, $this->password); $this->db_connect_id = mysqli_connect($this->server, $this->user, $this->password, NULL, $this->port);
if($this->db_connect_id) if($this->db_connect_id)
{ {
if($database != "") if($database != "")

@ -40,7 +40,7 @@
{ {
if ($this->isReading()) if ($this->isReading())
{ {
$val = ord($this->Buffer{$this->Pos++}); $val = ord($this->Buffer[$this->Pos++]);
debug(sprintf ("read uint8 '%d'<br>\n", $val)); debug(sprintf ("read uint8 '%d'<br>\n", $val));
} }
else else
@ -59,10 +59,10 @@
{ {
if ($this->isReading()) if ($this->isReading())
{ {
$val = ord($this->Buffer{$this->Pos++}); $val = ord($this->Buffer[$this->Pos++]);
$val += ord($this->Buffer{$this->Pos++})*256; $val += ord($this->Buffer[$this->Pos++])*256;
$val += ord($this->Buffer{$this->Pos++})*(double)256*256; $val += ord($this->Buffer[$this->Pos++])*(double)256*256;
$val += ord($this->Buffer{$this->Pos++})*(double)256*256*256; $val += ord($this->Buffer[$this->Pos++])*(double)256*256*256;
debug(sprintf ("read uint32 '%d'<br>\n", $val)); debug(sprintf ("read uint32 '%d'<br>\n", $val));
// var_dump($val); // var_dump($val);
} }

@ -74,7 +74,7 @@
die2(); die2();
} }
$domainName = getPost("domain"); $domainName = getPost("domain");
$nelLink = mysqli_connect($DBHost, $DBUserName, $DBPassword) or die2 (__FILE__. " " .__LINE__." Can't connect to database host:$DBHost user:$DBUserName"); $nelLink = mysqli_connect($DBHost, $DBUserName, $DBPassword, NULL, $DBPort) or die2 (__FILE__. " " .__LINE__." Can't connect to database host:$DBHost user:$DBUserName");
mysqli_select_db ($nelLink, $DBName) or die2 (__FILE__. " " .__LINE__." Can't access to the table dbname:$DBName"); mysqli_select_db ($nelLink, $DBName) or die2 (__FILE__. " " .__LINE__." Can't access to the table dbname:$DBName");
$domainName = mysqli_real_escape_string($nelLink, $domainName); $domainName = mysqli_real_escape_string($nelLink, $domainName);

@ -16,6 +16,7 @@ if ($cfg['db']['shard']['host'] != $cfg['db']['ring']['host'])
// where we can find the mysql database // where we can find the mysql database
$DBHost = $cfg['db']['shard']['host']; $DBHost = $cfg['db']['shard']['host'];
$DBPort = $cfg['db']['shard']['port'];
$DBUserName = $cfg['db']['shard']['user']; $DBUserName = $cfg['db']['shard']['user'];
$DBPassword = $cfg['db']['shard']['pass']; $DBPassword = $cfg['db']['shard']['pass'];
$DBName = $cfg['db']['shard']['name']; $DBName = $cfg['db']['shard']['name'];

@ -45,9 +45,9 @@
if ($resultCode == 0 && $cookie != "") if ($resultCode == 0 && $cookie != "")
{ {
// gather the domain information (server version, patch urls and backup patch url // gather the domain information (server version, patch urls and backup patch url
global $DBHost, $DBUserName, $DBPassword, $DBName, $AutoInsertInRing; global $DBHost, $DBPort, $DBUserName, $DBPassword, $DBName, $AutoInsertInRing;
$link = mysqli_connect($DBHost, $DBUserName, $DBPassword) or die (errorMsgBlock(3004, 'main', $DBHost, $DBUserName)); $link = mysqli_connect($DBHost, $DBUserName, $DBPassword, NULL, $DBPort) or die (errorMsgBlock(3004, 'main', $DBHost, $DBUserName));
mysqli_select_db ($link, $DBName) or die (errorMsgBlock(3005, 'main', $DBName, $DBHost, $DBUserName)); mysqli_select_db ($link, $DBName) or die (errorMsgBlock(3005, 'main', $DBName, $DBHost, $DBUserName));
$query = "SELECT * FROM domain WHERE domain_id=$domainId"; $query = "SELECT * FROM domain WHERE domain_id=$domainId";
$result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link))); $result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link)));
@ -191,7 +191,7 @@
if ($AutoCreateRingInfo) if ($AutoCreateRingInfo)
{ {
// check if the ring user exist, and create it if not // check if the ring user exist, and create it if not
$ringDb = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die(errorMsgBlock(3004, 'Ring', $DBHost, $RingDBUserName)); $ringDb = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword, NULL, $DBPort) or die(errorMsgBlock(3004, 'Ring', $DBHost, $RingDBUserName));
mysqli_select_db ($ringDb, $domainInfo['ring_db_name']) or die(errorMsgBlock(3005, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName)); mysqli_select_db ($ringDb, $domainInfo['ring_db_name']) or die(errorMsgBlock(3005, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName));
$query = "SELECT user_id FROM ring_users where user_id = '".$id."'"; $query = "SELECT user_id FROM ring_users where user_id = '".$id."'";
$result = mysqli_query ($ringDb, $query) or die(errorMsgBlock(3006, $query, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName, mysqli_error($ringDb))); $result = mysqli_query ($ringDb, $query) or die(errorMsgBlock(3006, $query, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName, mysqli_error($ringDb)));
@ -268,11 +268,11 @@
// return true if the check is ok // return true if the check is ok
function checkUserValidity ($login, $password, $clientApplication, $cp, &$id, &$reason, &$priv, &$extended, &$domainId, $lang) function checkUserValidity ($login, $password, $clientApplication, $cp, &$id, &$reason, &$priv, &$extended, &$domainId, $lang)
{ {
global $DBHost, $DBUserName, $DBPassword, $DBName, $AcceptUnknownUser; global $DBHost, $DBPort, $DBUserName, $DBPassword, $DBName, $AcceptUnknownUser;
setMsgLanguage($lang); setMsgLanguage($lang);
$link = mysqli_connect($DBHost, $DBUserName, $DBPassword) or die (errorMsgBlock(3004, 'main', $DBHost, $DBUserName)); $link = mysqli_connect($DBHost, $DBUserName, $DBPassword, NULL, $DBPort) or die (errorMsgBlock(3004, 'main', $DBHost, $DBUserName));
mysqli_select_db ($link, $DBName) or die (errorMsgBlock(3005, 'main', $DBName, $DBHost, $DBUserName)); mysqli_select_db ($link, $DBName) or die (errorMsgBlock(3005, 'main', $DBName, $DBHost, $DBUserName));
// we map the client application to the domain name // we map the client application to the domain name
@ -445,12 +445,12 @@
function askSalt($login, $lang) function askSalt($login, $lang)
{ {
global $PHP_SELF; global $PHP_SELF;
global $DBHost, $DBUserName, $DBPassword, $DBName; global $DBHost, $DBPort, $DBUserName, $DBPassword, $DBName;
global $AcceptUnknownUser; global $AcceptUnknownUser;
setMsgLanguage($lang); setMsgLanguage($lang);
$link = mysqli_connect($DBHost, $DBUserName, $DBPassword) or die (errorMsgBlock(3004, 'main', $DBHost, $DBUserName)); $link = mysqli_connect($DBHost, $DBUserName, $DBPassword, NULL, $DBPort) or die (errorMsgBlock(3004, 'main', $DBHost, $DBUserName));
mysqli_select_db ($link, $DBName) or die (errorMsgBlock(3005, 'main', $DBName, $DBHost, $DBUserName)); mysqli_select_db ($link, $DBName) or die (errorMsgBlock(3005, 'main', $DBName, $DBHost, $DBUserName));
$login = mysqli_real_escape_string($link, $login); $login = mysqli_real_escape_string($link, $login);

@ -16,9 +16,9 @@
$domainInfo = getDomainInfo($domainId); $domainInfo = getDomainInfo($domainId);
global $DBHost, $RingDBUserName, $RingDBPassword; global $DBHost, $DBPort, $RingDBUserName, $RingDBPassword;
$link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die ("Can't connect to database host:$DBHost user:$RingDBUserName"); $link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword, NULL, $DBPort) or die ("Can't connect to database host:$DBHost user:$RingDBUserName");
mysqli_select_db($link, $domainInfo['ring_db_name']) or die ("Can't access to the db dbname:" . $domainInfo['ring_db_name']); mysqli_select_db($link, $domainInfo['ring_db_name']) or die ("Can't access to the db dbname:" . $domainInfo['ring_db_name']);
// Find out if the character has an open editing session // Find out if the character has an open editing session

@ -42,9 +42,9 @@
if (isset($_POST["execute"])) if (isset($_POST["execute"]))
{ {
// lookup in the database to convert character name into // lookup in the database to convert character name into
global $DBHost, $RingDBUserName, $RingDBPassword; global $DBHost, $DBPort, $RingDBUserName, $RingDBPassword;
$link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die ("Can't connect to database host:$DBHost user:$RingDBUserName"); $link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword, NULL, $DBPort) or die ("Can't connect to database host:$DBHost user:$RingDBUserName");
mysqli_select_db($link, $domainInfo['ring_db_name']) or die ("Can't access to the table dbname:" . $domainInfo['ring_db_name']); mysqli_select_db($link, $domainInfo['ring_db_name']) or die ("Can't access to the table dbname:" . $domainInfo['ring_db_name']);
// extract the character that have the specified name // extract the character that have the specified name

@ -184,8 +184,8 @@ function displayAllShards(&$onlineShardsBySessionId)
} }
// List all shards of the domain, including offline ones // List all shards of the domain, including offline ones
global $DBName, $DBHost, $DBUserName, $DBPassword; global $DBName, $DBHost, $DBPort, $DBUserName, $DBPassword;
$link = mysqli_connect($DBHost, $DBUserName, $DBPassword) or die("Can't connect to nel database"); $link = mysqli_connect($DBHost, $DBUserName, $DBPassword, NULL, $DBPort) or die("Can't connect to nel database");
mysqli_select_db($link, $DBName) or die ("Can't access to the db dbname:$DBName"); mysqli_select_db($link, $DBName) or die ("Can't access to the db dbname:$DBName");
$domainId = (int) $domainId; $domainId = (int) $domainId;

@ -108,12 +108,12 @@ function inviteOwnerInSession($charId, $domainId, $sessionId)
$RSMPort = $addr[1]; $RSMPort = $addr[1];
global $rsmProxy, $rsmSkel, $userId, $charId, $callbackClient, /*$SessionId,*/ $SessionToolsResult; global $rsmProxy, $rsmSkel, $userId, $charId, $callbackClient, /*$SessionId,*/ $SessionToolsResult;
global $DBHost, $RingDBUserName, $RingDBPassword; global $DBHost, $DBPort, $RingDBUserName, $RingDBPassword;
$SessionId = $sessionId; $SessionId = $sessionId;
$DomainId = $domainId; $DomainId = $domainId;
$link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die("Can't connect to ring database"); $link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword, NULL, $DBPort) or die("Can't connect to ring database");
mysqli_select_db($link, $domainInfo['ring_db_name']) or die ("Can't access to the db dbname:" . $domainInfo['ring_db_name']); mysqli_select_db($link, $domainInfo['ring_db_name']) or die ("Can't access to the db dbname:" . $domainInfo['ring_db_name']);
$sessionId = (int) $sessionId; $sessionId = (int) $sessionId;

@ -42,7 +42,8 @@ function connect_database($continue, $name) {
$cfg['db'][$name]['host'], $cfg['db'][$name]['host'],
$cfg['db'][$name]['user'], $cfg['db'][$name]['user'],
$cfg['db'][$name]['pass'], $cfg['db'][$name]['pass'],
$cfg['db'][$name]['name']); $cfg['db'][$name]['name'],
$cfg['db'][$name]['port']);
if (mysqli_connect_errno()) { if (mysqli_connect_errno()) {
printalert("danger", "Failed to connect to the <em>" . $name . "</em> SQL server: " . mysqli_connect_error()); printalert("danger", "Failed to connect to the <em>" . $name . "</em> SQL server: " . mysqli_connect_error());
$con = null; $con = null;

@ -31,6 +31,8 @@ require_once('setup/version.php');
$roleSupport = isset($_POST["roleSupport"]) && $_POST["roleSupport"] == "on"; $roleSupport = isset($_POST["roleSupport"]) && $_POST["roleSupport"] == "on";
$roleDomain = isset($_POST["roleDomain"]) && $_POST["roleDomain"] == "on"; $roleDomain = isset($_POST["roleDomain"]) && $_POST["roleDomain"] == "on";
$continue = true;
if (!$roleService && !$roleSupport && !$roleDomain) { if (!$roleService && !$roleSupport && !$roleDomain) {
printalert("danger", "No server roles selected"); printalert("danger", "No server roles selected");
$continue = false; $continue = false;
@ -61,13 +63,13 @@ require_once('setup/version.php');
} }
if ($continue) { if ($continue) {
if ($roleService) { if ($roleService) {
$continue = validate_writable($continue, "login/logs/"); $continue = validate_writable($continue, "login/logs/") && $continue;
$continue = validate_writable($continue, "admin/graphs_output/"); $continue = validate_writable($continue, "admin/graphs_output/") && $continue;
$continue = validate_writable($continue, "admin/templates/default_c/"); $continue = validate_writable($continue, "admin/templates/default_c/") && $continue;
} }
if ($roleSupport) { if ($roleSupport) {
$continue = validate_writable($continue, "ams/cache/"); $continue = validate_writable($continue, "ams/cache/") && $continue;
$continue = validate_writable($continue, "ams/templates_c/"); $continue = validate_writable($continue, "ams/templates_c/") && $continue;
} }
$continue = validate_writable($continue, "./"); $continue = validate_writable($continue, "./");
if ($continue) { if ($continue) {
@ -77,7 +79,7 @@ require_once('setup/version.php');
$con = null; $con = null;
if ($continue) { // NOTE: Also test if this is reachable when not Service role if ($continue) { // NOTE: Also test if this is reachable when not Service role
$con = mysqli_connect($_POST["nelSqlHostname"], $_POST["nelSqlUsername"], $_POST["nelSqlPassword"]); $con = mysqli_connect($_POST["nelSqlHostname"], $_POST["nelSqlUsername"], $_POST["nelSqlPassword"], NULL, $_POST["nelSqlPort"]);
if (mysqli_connect_errno()) { if (mysqli_connect_errno()) {
printalert("danger", "Failed to connect to Service SQL: " . mysqli_connect_error()); printalert("danger", "Failed to connect to Service SQL: " . mysqli_connect_error());
$continue = false; $continue = false;
@ -89,44 +91,28 @@ require_once('setup/version.php');
if ($roleService) { if ($roleService) {
// Create NeL database // Create NeL database
$continue = create_use_database($continue, $con, $_POST["nelDatabase"]); $continue = create_use_database($continue, $con, $_POST["nelDatabase"]) && $continue;
// Create NeL Tools database // Create NeL Tools database
$continue = create_use_database($continue, $con, $_POST["toolDatabase"]); $continue = create_use_database($continue, $con, $_POST["toolDatabase"]) && $continue;
} }
if ($roleDomain) { if ($roleDomain) {
// Create Ring database // Create Ring database
$continue = create_use_database($continue, $con, $_POST["domainDatabase"]); $continue = create_use_database($continue, $con, $_POST["domainDatabase"]) && $continue;
}
if ($con) {
mysqli_close($con);
printalert("info", "Disconnected from the Service SQL server");
} }
if ($roleSupport) { if ($roleSupport) {
if ($continue) {
$con = mysqli_connect($_POST["amsSqlHostname"], $_POST["amsSqlUsername"], $_POST["amsSqlPassword"]);
if (mysqli_connect_errno()) {
printalert("danger", "Failed to connect to Support SQL: " . mysqli_connect_error());
$continue = false;
$con = null;
} else {
printalert("success", "Connected to the Support SQL server");
}
}
// Create AMS database // Create AMS database
$continue = create_use_database($continue, $con, $_POST["amsDatabase"]); $continue = create_use_database($continue, $con, $_POST["amsDatabase"]) && $continue;
// Create AMS Library database // Create AMS Library database
$continue = create_use_database($continue, $con, $_POST["amsLibDatabase"]); $continue = create_use_database($continue, $con, $_POST["amsLibDatabase"]) && $continue;
}
if ($con) { if ($con) {
mysqli_close($con); mysqli_close($con);
printalert("info", "Disconnected from the Support SQL server"); printalert("info", "Disconnected from the Service SQL server");
}
} }
// Write config.php // Write config.php
@ -140,6 +126,7 @@ require_once('setup/version.php');
$config = str_replace("%privatePhpDirectory%", addslashes(realpath($cwd . "/" . $_POST["privatePhpDirectory"])), $config); $config = str_replace("%privatePhpDirectory%", addslashes(realpath($cwd . "/" . $_POST["privatePhpDirectory"])), $config);
$config = str_replace("%publicPhpDirectory%", addslashes(realpath($cwd)), $config); $config = str_replace("%publicPhpDirectory%", addslashes(realpath($cwd)), $config);
$config = str_replace("%nelSqlHostname%", addslashes($_POST["nelSqlHostname"]), $config); $config = str_replace("%nelSqlHostname%", addslashes($_POST["nelSqlHostname"]), $config);
$config = str_replace("%nelSqlPort%", addslashes($_POST["nelSqlPort"]), $config);
$config = str_replace("%nelSqlUsername%", addslashes($_POST["nelSqlUsername"]), $config); $config = str_replace("%nelSqlUsername%", addslashes($_POST["nelSqlUsername"]), $config);
$config = str_replace("%nelSqlPassword%", addslashes($_POST["nelSqlPassword"]), $config); $config = str_replace("%nelSqlPassword%", addslashes($_POST["nelSqlPassword"]), $config);
$config = str_replace("%nelDatabase%", addslashes($_POST["nelDatabase"]), $config); $config = str_replace("%nelDatabase%", addslashes($_POST["nelDatabase"]), $config);
@ -193,15 +180,15 @@ require_once('setup/version.php');
require_once('database.php'); require_once('database.php');
if ($roleSupport) { if ($roleSupport) {
$continue = upgrade_support_databases($continue); $continue = upgrade_support_databases($continue) && $continue;
} }
if ($roleService) { if ($roleService) {
$continue = upgrade_service_databases($continue); $continue = upgrade_service_databases($continue) && $continue;
} }
if ($roleDomain) { if ($roleDomain) {
$continue = upgrade_domain_databases($continue); $continue = upgrade_domain_databases($continue) && $continue;
} }
if ($roleService) { if ($roleService) {

@ -51,13 +51,11 @@ if (!isset($NEL_SETUP_VERSION_CONFIGURED)) {
$config = str_replace("%privatePhpDirectory%", addslashes($PRIVATE_PHP_PATH), $config); $config = str_replace("%privatePhpDirectory%", addslashes($PRIVATE_PHP_PATH), $config);
$config = str_replace("%publicPhpDirectory%", addslashes($PUBLIC_PHP_PATH), $config); $config = str_replace("%publicPhpDirectory%", addslashes($PUBLIC_PHP_PATH), $config);
$config = str_replace("%nelSqlHostname%", addslashes($cfg['db']['shard']['host']), $config); $config = str_replace("%nelSqlHostname%", addslashes($cfg['db']['shard']['host']), $config);
$config = str_replace("%nelSqlPort%", addslashes($cfg['db']['shard']['port']), $config);
$config = str_replace("%nelSqlUsername%", addslashes($cfg['db']['shard']['user']), $config); $config = str_replace("%nelSqlUsername%", addslashes($cfg['db']['shard']['user']), $config);
$config = str_replace("%nelSqlPassword%", addslashes($cfg['db']['shard']['pass']), $config); $config = str_replace("%nelSqlPassword%", addslashes($cfg['db']['shard']['pass']), $config);
$config = str_replace("%nelDatabase%", addslashes($cfg['db']['shard']['name']), $config); $config = str_replace("%nelDatabase%", addslashes($cfg['db']['shard']['name']), $config);
$config = str_replace("%toolDatabase%", addslashes($cfg['db']['tool']['name']), $config); $config = str_replace("%toolDatabase%", addslashes($cfg['db']['tool']['name']), $config);
$config = str_replace("%amsSqlHostname%", addslashes($cfg['db']['lib']['host']), $config);
$config = str_replace("%amsSqlUsername%", addslashes($cfg['db']['lib']['user']), $config);
$config = str_replace("%amsSqlPassword%", addslashes($cfg['db']['lib']['pass']), $config);
$config = str_replace("%amsDatabase%", addslashes($cfg['db']['web']['name']), $config); $config = str_replace("%amsDatabase%", addslashes($cfg['db']['web']['name']), $config);
$config = str_replace("%amsLibDatabase%", addslashes($cfg['db']['lib']['name']), $config); $config = str_replace("%amsLibDatabase%", addslashes($cfg['db']['lib']['name']), $config);
$config = str_replace("%nelSetupPassword%", addslashes($NEL_SETUP_PASSWORD), $config); $config = str_replace("%nelSetupPassword%", addslashes($NEL_SETUP_PASSWORD), $config);
@ -66,10 +64,15 @@ if (!isset($NEL_SETUP_VERSION_CONFIGURED)) {
$config = str_replace("%cryptKey%", addslashes($cfg['crypt']['key']), $config); $config = str_replace("%cryptKey%", addslashes($cfg['crypt']['key']), $config);
$config = str_replace("%cryptKeyIMAP%", addslashes($SUPPORT_GROUP_IMAP_CRYPTKEY), $config); $config = str_replace("%cryptKeyIMAP%", addslashes($SUPPORT_GROUP_IMAP_CRYPTKEY), $config);
if ($NEL_SETUP_VERSION_CONFIGURED < 2) { if ($NEL_SETUP_VERSION_CONFIGURED < 2) {
$config = str_replace("%domainDatabase%", "mini01", $config); $config = str_replace("%domainDatabase%", addslashes($NEL_DOMAIN_NAME + "_ring"), $config);
} else { } else {
$config = str_replace("%domainDatabase%", addslashes($cfg['db']['ring']['name']), $config); $config = str_replace("%domainDatabase%", addslashes($cfg['db']['ring']['name']), $config);
} }
if ($NEL_SETUP_VERSION_CONFIGURED < 9) {
$config = str_replace("%domainUsersDir%", addslashes("/home/nevrax/" + $NEL_DOMAIN_NAME + "/www"), $config);
} else {
$config = str_replace("%domainUsersDir%", addslashes($USERS_DIR), $config);
}
if (file_put_contents("config.php", $config)) { if (file_put_contents("config.php", $config)) {
printalert("success", "Generated <em>config.php</em>"); printalert("success", "Generated <em>config.php</em>");
} else { } else {

@ -1,6 +1,6 @@
<?php <?php
// Increment whenever a web upgrade is required. // Increment whenever a web upgrade is required.
$NEL_SETUP_VERSION = 8; $NEL_SETUP_VERSION = 9;
/* end of file */ /* end of file */

@ -82,6 +82,7 @@
function debug($str) function debug($str)
{ {
global $StatsDBHost; global $StatsDBHost;
global $DBPort;
global $StatsDBUserName; global $StatsDBUserName;
global $StatsDBPassword; global $StatsDBPassword;
global $StatsDBName; global $StatsDBName;
@ -91,7 +92,7 @@
if ($link == NULL) if ($link == NULL)
{ {
$link = mysql_connect($StatsDBHost, $StatsDBUserName, $StatsDBPassword) or die2 (__FILE__. " " .__LINE__." Can't connect to database host:$StatsDBHost user:$StatsDBUserName"); $link = mysql_connect($StatsDBHost, $StatsDBUserName, $StatsDBPassword, NULL, $DBPort) or die2 (__FILE__. " " .__LINE__." Can't connect to database host:$StatsDBHost user:$StatsDBUserName");
$newConnection = 1; $newConnection = 1;
mysql_select_db ($StatsDBName, $link) or die2 (__FILE__. " " .__LINE__." Can't access to the table dbname:$StatsDBName"); mysql_select_db ($StatsDBName, $link) or die2 (__FILE__. " " .__LINE__." Can't access to the table dbname:$StatsDBName");
@ -139,7 +140,7 @@
$date = date('Y-m-d H:i:s', time()); $date = date('Y-m-d H:i:s', time());
$ip = getIp(); $ip = getIp();
$log = getenv("QUERY_STRING"); $log = getenv("QUERY_STRING");
$link = mysql_connect($StatsDBHost, $StatsDBUserName, $StatsDBPassword) or die2 (__FILE__. " " .__LINE__." Can't connect to database host:$StatsDBHost user:$StatsDBUserName"); $link = mysql_connect($StatsDBHost, $StatsDBUserName, $StatsDBPassword, NULL, $DBPort) or die2 (__FILE__. " " .__LINE__." Can't connect to database host:$StatsDBHost user:$StatsDBUserName");
mysql_select_db ($StatsDBName, $link) or die2 (__FILE__. " " .__LINE__." Can't access to the table dbname:$StatsDBName"); mysql_select_db ($StatsDBName, $link) or die2 (__FILE__. " " .__LINE__." Can't access to the table dbname:$StatsDBName");

@ -155,6 +155,7 @@
function debug($str) function debug($str)
{ {
global $StatsDBHost; global $StatsDBHost;
global $DBPort;
global $StatsDBUserName; global $StatsDBUserName;
global $StatsDBPassword; global $StatsDBPassword;
global $StatsDBName; global $StatsDBName;
@ -164,7 +165,7 @@
if ($link == NULL) if ($link == NULL)
{ {
$link = mysql_connect($StatsDBHost, $StatsDBUserName, $StatsDBPassword) or die2 (__FILE__. " " .__LINE__." can't connect to database host:$StatsDBHost user:$StatsDBUserName"); $link = mysql_connect($StatsDBHost, $StatsDBUserName, $StatsDBPassword, NULL, $DBPort) or die2 (__FILE__. " " .__LINE__." can't connect to database host:$StatsDBHost user:$StatsDBUserName");
$newConnection = 1; $newConnection = 1;
mysql_select_db ($StatsDBName, $link) or die2 (__FILE__. " " .__LINE__." can't access to the table dbname:$StatsDBName"); mysql_select_db ($StatsDBName, $link) or die2 (__FILE__. " " .__LINE__." can't access to the table dbname:$StatsDBName");
@ -794,7 +795,7 @@
$date = date('Y-m-d H:i:s', time()); $date = date('Y-m-d H:i:s', time());
$ip = getIp(); $ip = getIp();
$log = getenv("query_string"); $log = getenv("query_string");
$link = mysql_connect($StatsDBHost, $StatsDBUserName, $StatsDBPassword) or die2 (__FILE__. " " .__LINE__." can't connect to database host:$StatsDBHost user:$StatsDBUserName"); $link = mysql_connect($StatsDBHost, $StatsDBUserName, $StatsDBPassword, NULL, $DBPort) or die2 (__FILE__. " " .__LINE__." can't connect to database host:$StatsDBHost user:$StatsDBUserName");
mysql_select_db ($StatsDBName, $link) or die2 (__FILE__. " " .__LINE__." can't access to the table dbname:$StatsDBName"); mysql_select_db ($StatsDBName, $link) or die2 (__FILE__. " " .__LINE__." can't access to the table dbname:$StatsDBName");

@ -4,9 +4,9 @@
function getDomainInfo($domainId) function getDomainInfo($domainId)
{ {
global $DBHost, $DBUserName, $DBPassword, $DBName; global $DBHost, $DBPort, $DBUserName, $DBPassword, $DBName;
$link = mysqli_connect($DBHost, $DBUserName, $DBPassword) or die("can't connect to nel db"); $link = mysqli_connect($DBHost, $DBUserName, $DBPassword, NULL, $DBPort) or die("can't connect to nel db");
mysqli_select_db ($link, $DBName) or die("can't select nel db"); mysqli_select_db ($link, $DBName) or die("can't select nel db");
$domainId = (int)$domainId; $domainId = (int)$domainId;

@ -18,7 +18,7 @@
{ {
$domainInfo = getDomainInfo($domainId); $domainInfo = getDomainInfo($domainId);
global $DBHost, $RingDBUserName, $RingDBPassword, $AcceptUnknownUser; global $DBHost, $DBPort, $RingDBUserName, $RingDBPassword, $AcceptUnknownUser;
if (!isset($_COOKIE["ryzomId"])) if (!isset($_COOKIE["ryzomId"]))
{ {
@ -42,7 +42,7 @@
} }
// check the cookie in the database // check the cookie in the database
$link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die ("Can't connect to database host:$DBHost user:$RingDBUserName"); $link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword, NULL, $DBPort) or die ("Can't connect to database host:$DBHost user:$RingDBUserName");
mysqli_select_db($link, $domainInfo['ring_db_name']) or die ("Can't access to the table dbname:" . $domainInfo['ring_db_name']); mysqli_select_db($link, $domainInfo['ring_db_name']) or die ("Can't access to the table dbname:" . $domainInfo['ring_db_name']);
$cookie = mysqli_real_escape_string($link, $cookie); $cookie = mysqli_real_escape_string($link, $cookie);

@ -402,8 +402,8 @@ include_once('login/config.php');
// ------------------------------------- // -------------------------------------
function connect_to_ring_db() function connect_to_ring_db()
{ {
global $DBHost, $RingDBUserName, $RingDBPassword, $RingDBName; global $DBHost, $DBPort, $RingDBUserName, $RingDBPassword, $RingDBName;
$ringDb = mysql_connect($DBHost, $RingDBUserName, $RingDBPassword) or die("can't connect to ring db @'".$DBHost."' with user '".$RingDBUserName."'"); $ringDb = mysql_connect($DBHost, $RingDBUserName, $RingDBPassword, NULL, $DBPort) or die("can't connect to ring db @'".$DBHost."' with user '".$RingDBUserName."'");
mysql_select_db($RingDBName, $ringDb) or die("can't select ring db: '$RingDBName' Host=$DBHost User=$RingDBUserName (not enough privilege?)"); mysql_select_db($RingDBName, $ringDb) or die("can't select ring db: '$RingDBName' Host=$DBHost User=$RingDBUserName (not enough privilege?)");
return $ringDb; return $ringDb;
} }

Loading…
Cancel
Save