Add infos into target window
[ryzomcore.git] / ryzom / server / www / login / libs / r2_login_logincb.php
bloba7cba272972da9c3ff2304bfde90abe73ac82649
1 <?php
4 class LoginCb extends CLoginServiceWeb {
6 function init($db, $ServerDomain) {
7 $this->db = $db;
8 $this->domainInfo = $ServerDomain->domainInfo;
9 $this->domainId = $ServerDomain->id;
13 // receive the login result sent back by the LS
14 function loginResult($userId, $cookie, $resultCode, $errorString) {
15 if ($resultCode == 0 && $cookie != '') {
16 // gather the domain informations (server version, patch urls and backup patch url
18 $RingWebHost = $this->domainInfo['web_host'];
19 $RingWebHostPHP = $this->domainInfo['web_host_php'];
21 // set the cookie
22 setcookie('ryzomId' , $cookie, 0, '/');
23 $_COOKIE['ryzomId'] = $cookie; // make it available immediately
25 // Auto-join an available mainland shard
26 global $FSHostLuaMode, $FSHostResultStr;
27 $FSHostLuaMode = false;
28 $res = joinMainland($userId, $this->domainId, $this->domainInfo['domain_name']);
30 if ($res) {
31 // return the cookie to the user, il will then be used as an auth to browse the site and to connect to the shard
32 //echo "1#".$cookie."#http://".$RingWebHost."/ring/web_start.php\n";
33 // use this line to use woopra stats
34 // echo "1#".$cookie."#".$FSHostResultStr."#http://".$RingWebHost."/ring/web_start.php#http://".$RingWebHostPHP."/ring/#1\n";
35 echo '1#'.$cookie.'#'.$FSHostResultStr.'#http://'.$RingWebHost.'/ring/web_start.php#http://'.$RingWebHostPHP.'/ring/'."\n";
36 // return the ring domain information
37 echo $this->domainInfo['patch_version'].'#'.$this->domainInfo['backup_patch_url'].'#'.$this->domainInfo['patch_urls'];
39 } else {
40 global $JoinSessionResultCode, $JoinSessionResultMsg;
41 echo errorMsgBlock(BASE_TRANSLATED_RSM_ERROR_NUM + $JoinSessionResultCode, $JoinSessionResultCode, $JoinSessionResultMsg, $userId);
43 } else {
44 // empty cookie, this mean the user id can't be validated by the LS
45 echo errorMsgBlock(BASE_TRANSLATED_LS_ERROR_NUM + $resultCode, $resultCode, $errorString, $userId);