$salt = createSalt(); } else { die("0:Unknown login {$login} (error code 64)"); } } else { $res_array = mysql_fetch_array($result); $salt = substr($res_array['Password'], 0, 2); } echo "1:" . $salt; mysql_close($link); } // -------------------------------------------------------------------------------------- // main // -------------------------------------------------------------------------------------- if ($_GET["cmd"] == "ask") { askSalt($_GET["login"]); die; } // check cp is set (force bool) $cp = $_GET["cp"] == "1"; if (!checkUserValidity($_GET["login"], $_GET["password"], $_GET["clientApplication"], $cp, $id, $reason, $priv, $extended)) { echo "0:" . $reason; } else { if ($_GET["cmd"] == "login") { checkShardAccess($id, $_GET["clientApplication"], $_GET["shardid"]); // user selected a shard, try to add the user to the shard if (askClientConnection($_GET["shardid"], $id, $_GET["login"], $priv, $extended, $res, $patchURLS)) { // access granted, send cookie and addr echo "1:" . $res; // LS sent patching URLS? Add them at the end of the string if (strlen($patchURLS) > 0) {
die(errorMsgBlock(3002)); } // check for 'clear password' tag if (!isset($_GET['cp'])) { $cp = 0; } else { $cp = $_GET['cp']; } $submittedLang = isset($_GET['lg']) ? $_GET['lg'] : 'unknown'; if (isset($_GET['dbg']) && $_GET['dbg'] == 1) { $DisplayDbg = true; } switch ($_GET['cmd']) { case 'ask': // client ask for a login salt askSalt($_GET['login'], $submittedLang); die; case 'login': $domainId = -1; // client sent is login info if (!checkUserValidity($_GET['login'], $_GET['password'], $_GET['clientApplication'], $cp, $id, $reason, $priv, $extended, $domainId, $submittedLang)) { echo '0:' . $reason; } else { // retreive the domain info $domainInfo = getDomainInfo($domainId); // 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 . "'";