Ejemplo n.º 1
0
/**
 * Authenticate and request to join a mainland shard
 */
function joinMainlandPost()
{
    global $FSHostLuaMode;
    $FSHostLuaMode = true;
    $domainId = -1;
    if (!validateCookie($userId, $domainId, $charId)) {
        echo "Invalid cookie !";
        die;
    } else {
        joinMainland($userId, $domainId);
    }
}
Ejemplo n.º 2
0
 function loginResult($userId, $cookie, $resultCode, $errorString)
 {
     global $RingWebHost, $RingWebHostPHP;
     global $domainId;
     if ($resultCode == 0 && $cookie != "") {
         // gather the domain information (server version, patch urls and backup patch url
         global $DBHost, $DBUserName, $DBPassword, $DBName, $AutoInsertInRing;
         $link = mysqli_connect($DBHost, $DBUserName, $DBPassword) or die(errorMsgBlock(3004, 'main', $DBHost, $DBUserName));
         mysqli_select_db($link, $DBName) or die(errorMsgBlock(3005, 'main', $DBName, $DBHost, $DBUserName));
         $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)));
         if (mysqli_num_rows($result) != 1) {
             die(errorMsgBlock(3001, $domainId));
         }
         $row = mysqli_fetch_array($result);
         // set the cookie
         setcookie("ryzomId", $cookie, 0, "/");
         $_COOKIE["ryzomId"] = $cookie;
         // make it available immediately
         // Auto-join an available mainland shard
         global $FSHostLuaMode, $FSHostResultStr;
         $FSHostLuaMode = false;
         $res = joinMainland($userId, $domainId, $row["domain_name"]);
         if ($res) {
             // return the cookie to the user, il will then be used as an auth to browse the site and to connect to the shard
             //echo "1#".$cookie."#http://".$RingWebHost."/ring/web_start.php\n";
             // use this line to use woopra stats
             //                  echo "1#".$cookie."#".$FSHostResultStr."#http://".$RingWebHost."/ring/web_start.php#http://".$RingWebHostPHP."/ring/#1\n";
             echo "1#" . $cookie . "#" . $FSHostResultStr . "#http://" . $RingWebHost . "/ring/web_start.php#http://" . $RingWebHostPHP . "/ring/\n";
             // return the ring domain information
             echo $row["patch_version"] . "#" . $row["backup_patch_url"] . "#" . $row["patch_urls"];
         } else {
             global $JoinSessionResultCode, $JoinSessionResultMsg;
             echo errorMsgBlock(BASE_TRANSLATED_RSM_ERROR_NUM + $JoinSessionResultCode, $JoinSessionResultCode, $JoinSessionResultMsg, $userId);
         }
     } else {
         // empty cookie, this mean the user id can't be validated by the LS
         echo errorMsgBlock(BASE_TRANSLATED_LS_ERROR_NUM + $resultCode, $resultCode, $errorString, $userId);
     }
 }