Extract ring creation function
This commit is contained in:
parent
436bfd0c36
commit
6aca9390fa
1 changed files with 20 additions and 12 deletions
|
@ -49,6 +49,25 @@ class ConnectionHandler
|
|||
return $salt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the db ring.
|
||||
* @todo: currently broken, because it uses globals.
|
||||
*/
|
||||
private function CreateRing($domainInfo)
|
||||
{ // check if the ring user exist, and create it if not
|
||||
// $ringDb = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) 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));
|
||||
// $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)));
|
||||
|
||||
// if (mysqli_num_rows($result) == 0) {
|
||||
// // no ring user record, build one
|
||||
// $login = mysqli_real_escape_string($ringDb, $_GET['login']);
|
||||
// $query = "INSERT INTO ring_users SET user_id = '$id', user_name = '$login', user_type='ut_pioneer'";
|
||||
// $result = mysqli_query($ringDb, $query) or die(errorMsgBlock(3006, $query, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName, mysqli_error($ringDb)));
|
||||
// }
|
||||
}
|
||||
|
||||
private function Login($login, $password, $clientApplication, $cp, $submittedLang)
|
||||
{
|
||||
$res = false;
|
||||
|
@ -63,18 +82,7 @@ class ConnectionHandler
|
|||
|
||||
// if we need to create missing ring info
|
||||
if ($AutoCreateRingInfo) {
|
||||
// check if the ring user exist, and create it if not
|
||||
$ringDb = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) 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));
|
||||
$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)));
|
||||
|
||||
if (mysqli_num_rows($result) == 0) {
|
||||
// no ring user record, build one
|
||||
$login = mysqli_real_escape_string($ringDb, $_GET['login']);
|
||||
$query = "INSERT INTO ring_users SET user_id = '$id', user_name = '$login', user_type='ut_pioneer'";
|
||||
$result = mysqli_query($ringDb, $query) or die(errorMsgBlock(3006, $query, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName, mysqli_error($ringDb)));
|
||||
}
|
||||
CreateRing($domainInfo);
|
||||
}
|
||||
|
||||
// store the web host for this domain
|
||||
|
|
Loading…
Reference in a new issue