From 22c1d33aa18efea37d91285a901490da4dbb3c81 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 10 Sep 2014 05:25:00 +0200 Subject: [PATCH] Use the correct ring database --- code/web/public_php/login/config.php | 1 - code/web/public_php/ring/edit_session.php | 4 ++-- code/web/public_php/ring/invite_pioneer.php | 4 ++-- code/web/public_php/ring/session_tools.php | 8 ++++---- code/web/public_php/tools/validate_cookie.php | 6 ++++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/code/web/public_php/login/config.php b/code/web/public_php/login/config.php index 805252b62..d69bdfea1 100644 --- a/code/web/public_php/login/config.php +++ b/code/web/public_php/login/config.php @@ -21,7 +21,6 @@ $DBName = $cfg['db']['shard']['name']; $RingDBUserName = $cfg['db']['ring']['user']; $RingDBPassword = $cfg['db']['ring']['pass']; -$RingDBName = $cfg['db']['ring']['name']; // If true, the server will add automatically unknown user in the database // (in nel.user, nel.permission, ring.ring_user and ring.characters diff --git a/code/web/public_php/ring/edit_session.php b/code/web/public_php/ring/edit_session.php index e567f2296..4fef39520 100644 --- a/code/web/public_php/ring/edit_session.php +++ b/code/web/public_php/ring/edit_session.php @@ -16,10 +16,10 @@ $domainInfo = getDomainInfo($domainId); - global $DBHost, $RingDBUserName, $RingDBPassword, $RingDBName; + global $DBHost, $RingDBUserName, $RingDBPassword; $link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die ("Can't connect to database host:$DBHost user:$RingDBUserName"); - mysqli_select_db($link, $RingDBName) or die ("Can't access to the db dbname:$RingDBName"); + 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 $query = "SELECT session_id, state "; diff --git a/code/web/public_php/ring/invite_pioneer.php b/code/web/public_php/ring/invite_pioneer.php index 44cd83349..bb1f5ca7e 100644 --- a/code/web/public_php/ring/invite_pioneer.php +++ b/code/web/public_php/ring/invite_pioneer.php @@ -42,10 +42,10 @@ if (isset($_POST["execute"])) { // lookup in the database to convert character name into - global $DBHost, $RingDBUserName, $RingDBPassword, $RingDBName; + global $DBHost, $RingDBUserName, $RingDBPassword; $link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die ("Can't connect to database host:$DBHost user:$RingDBUserName"); - mysqli_select_db($link, $RingDBName) or die ("Can't access to the table dbname:$RingDBName"); + 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 $charName = mysqli_real_escape_string($link, $_POST['charName']); diff --git a/code/web/public_php/ring/session_tools.php b/code/web/public_php/ring/session_tools.php index de6900727..e5f12763f 100644 --- a/code/web/public_php/ring/session_tools.php +++ b/code/web/public_php/ring/session_tools.php @@ -107,14 +107,14 @@ function inviteOwnerInSession($charId, $domainId, $sessionId) $RSMHost = $addr[0]; $RSMPort = $addr[1]; - global $rsmProxy, $rsmSkel, $userId, $charId, $callbackClient, $RingDBName, /*$SessionId,*/ $SessionToolsResult; + global $rsmProxy, $rsmSkel, $userId, $charId, $callbackClient, /*$SessionId,*/ $SessionToolsResult; global $DBHost, $RingDBUserName, $RingDBPassword; $SessionId = $sessionId; $DomainId = $domainId; $link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die("Can't connect to ring database"); - mysqli_select_db($link, $RingDBName) or die ("Can't access to the db dbname:$RingDBName"); + mysqli_select_db($link, $domainInfo['ring_db_name']) or die ("Can't access to the db dbname:" . $domainInfo['ring_db_name']); $sessionId = (int) $sessionId; $query = "select session_type from sessions where session_id=".$sessionId; @@ -146,7 +146,7 @@ class StartSessionCb extends CRingSessionManagerWeb { function invokeResult($userId, $resultCode, $resultString) { - global $rsmProxy, $rsmSkel, $userId, $charId, $callbackClient, $RingDBName, $SessionId, $DomainId, $SessionToolsResult; + global $rsmProxy, $rsmSkel, $userId, $charId, $callbackClient, $SessionId, $DomainId, $SessionToolsResult; if ($resultCode != 0) { @@ -170,7 +170,7 @@ class InviteOwnerCb extends CRingSessionManagerWeb { function invokeResult($userId, $resultCode, $resultString) { - global $rsmProxy, $rsmSkel, $userId, $charId, $callbackClient, $RingDBName, $SessionId, $DomainId, $SessionToolsResult; + global $rsmProxy, $rsmSkel, $userId, $charId, $callbackClient, $SessionId, $DomainId, $SessionToolsResult; // jump back to main page echo "

The session ".$SessionId." have been started

"; diff --git a/code/web/public_php/tools/validate_cookie.php b/code/web/public_php/tools/validate_cookie.php index edea9904e..a62f026b7 100644 --- a/code/web/public_php/tools/validate_cookie.php +++ b/code/web/public_php/tools/validate_cookie.php @@ -16,7 +16,9 @@ function validateCookie(&$userId, &$domainId, &$charId) { - global $DBHost, $RingDBUserName, $RingDBPassword, $RingDBName, $AcceptUnknownUser; + $domainInfo = getDomainInfo($domainId); + + global $DBHost, $RingDBUserName, $RingDBPassword, $AcceptUnknownUser; if (!isset($_COOKIE["ryzomId"])) { @@ -41,7 +43,7 @@ // check the cookie in the database $link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die ("Can't connect to database host:$DBHost user:$RingDBUserName"); - mysqli_select_db($link, $RingDBName) or die ("Can't access to the table dbname:$RingDBName"); + 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); $query = "SELECT user_id, current_status, current_domain_id FROM ring_users where cookie='$cookie'";