Example #1
0
 /**
  * 检查错误 
  * @param unm
  */
 protected function check_error($data)
 {
     if ($data === true) {
         return;
     }
     //        if(!is_numeric($data)){
     //            return ;
     //        }
     if ($this->is_trans()) {
         $this->rollback();
     }
     //        $data = array(0=>$data);
     //        Protocol::make_data($data);
     //        Protocol::output(3, 7,701);
     //
     //
     //
     if (is_array($data)) {
         if (count($data) == 1 && isset($data['error'])) {
             $error = $data['error'];
             exit(Language_Error::return_error($error['code'], $error['title'] ? $error['title'] : '10221', $error['replace']));
         }
     } else {
         exit(Language_Error::return_error($data));
     }
 }
Example #2
0
 public function sendSysMail($dataArr, $type, $nowTime, $ip)
 {
     global $AccountArr;
     if (!isset($AccountArr)) {
         echo "not require AccountArr\n";
         $filename = DATA_PATH . '/cache/ceshi_user.cache';
         if (file_exists($filename)) {
             echo "require AccountArr\n";
             require_once $filename;
         } else {
             $AccountArr = array();
         }
     }
     $account = $dataArr['account'];
     $player_id = $dataArr['player_id'];
     if (!empty($AccountArr) && isset($AccountArr[SERVER_ID])) {
         $dataArr = $AccountArr[SERVER_ID];
         if (in_array($account, $dataArr['account'])) {
             $mail["mail_type"] = 0;
             $mail["sender"] = 0;
             $mail["sender_name"] = Language_Error::get_language_error('ERROR_MAIL_3');
             $mail["receiver"] = $player_id;
             $mail["title"] = $dataArr['title'];
             $mail["content"] = $dataArr['content'];
             $mail["silver"] = 0;
             $mail["gold"] = 0;
             if (!empty($dataArr['props'])) {
                 $props = explode(';', $dataArr['props']);
                 foreach ($props as $prop) {
                     $propArr = explode(':', $prop);
                     if (!isset($propArr[2])) {
                         $propArr[2] = 0;
                     }
                     $mail["prop"][] = array("prop_id" => $propArr[0], "item_num" => $propArr[1], "quality" => $propArr[2]);
                 }
                 $mail["attachment"]["prop"] = $mail["prop"];
             }
             $mail["attachment"] = array();
             if ($mail["mail_type"] === 0) {
                 if (isset($mail["silver"])) {
                     if ($mail["silver"] > 0) {
                         $mail["attachment"]["silver"] = $mail["silver"];
                     }
                     unset($mail["silver"]);
                 }
                 if (isset($mail["gold"])) {
                     if ($mail["gold"] > 0) {
                         $mail["attachment"]["gold"] = $mail["gold"];
                     }
                     unset($mail["gold"]);
                 }
                 if (isset($mail["prop"])) {
                     if (!empty($mail["prop"])) {
                         $mail["attachment"]["prop"] = $mail["prop"];
                     }
                     unset($mail["prop"]);
                 }
                 if (count($mail["attachment"]) > 0) {
                     $mail["attachment_state"] = 1;
                 }
             }
             //file_put_contents(PROJECT_ROOT.'/uuzudo.log',var_export(array('sendMessage',$account,$op,$nowTime,$ip),true)."\n",FILE_APPEND);
             Com_Queued::send("mail", Com_Serialize::serialize($mail));
         }
     }
 }
Example #3
0
 public static function auth()
 {
     //	if(isset($_REQUEST['sid']) && is_numeric($_REQUEST['sid']) && SERVER_ID == 1 && !isset($_SESSION['player_id'])){
     if (isset($_REQUEST['loginid']) && isset($_REQUEST['sid'])) {
         $objPlayerData = TenYear::getInstance('Data_Player');
         $arrUser = $objPlayerData->get_player_info($_REQUEST['loginid']);
         if (empty($arrUser)) {
             $objSession = TenYear::getInstance('session');
             $objSession->set_is_write(false);
             $arrLanguage = Language_Error::get_language_error_assoc(array('10221', 'LOGIN_MSG_21'));
             $content = $arrLanguage['LOGIN_MSG_21'];
             $title = $arrLanguage['10221'];
             $url = MAIN_DOMAIN_URL;
             $data = array();
             $data['content'] = $content;
             $data['title'] = $title;
             $data['code'] = 'LOGIN_MSG_21';
             $data['url'] = $url;
             Protocol::make_data($data);
             Protocol::output(4, 2);
         } else {
             $_SESSION['sid'] = session_id();
             $_SESSION["account"] = $arrUser['user_account'];
             $_SESSION["player_id"] = $arrUser["player_id"];
             $_SESSION["player_name"] = $arrUser["name"];
             $_SESSION["player_sex"] = $arrUser["sex"];
             $_SESSION["player_level"] = $arrUser["level"];
             $_SESSION["vip_level"] = $arrUser["vip_level"];
             $_SESSION["avatar"] = $arrUser["avatar"];
             $_SESSION["career_type"] = $arrUser["career_type"];
             $_SESSION["city_id"] = $arrUser["city_id"];
             $_SESSION["active_time"] = time();
             $_SESSION["logintime"] = time();
             $_SESSION["adult_flag"] = 0;
             $_SESSION["adult_game_time"] = 0;
             $_SESSION['expire'] = $time;
             $_SESSION["gm"] = $arrUser["gm"];
             $objOnline = TenYear::getInstance('Game_Online');
             $objOnline->write_session();
             //	$objOnline->check_online_data($arrUser["player_id"], true);
         }
     }
     //当前session已经被污染成新playerid
     if (isset($_REQUEST['loginid']) && $_REQUEST['loginid'] != $_SESSION['player_id']) {
         $_SESSION['player_id'] = 0;
     }
     if (!isset($_SESSION['player_id']) || !$_SESSION['player_id']) {
         //	$objSession = TenYear::getInstance('session');
         //	$objSession->set_is_write(false);
         $arrLanguage = Language_Error::get_language_error_assoc(array('10221', 'LOGIN_MSG_21'));
         $content = $arrLanguage['LOGIN_MSG_21'];
         $title = $arrLanguage['10221'];
         $url = MAIN_DOMAIN_URL;
         $data = array();
         $data['title'] = $title;
         $data['content'] = $content;
         $data['code'] = 'LOGIN_MSG_21';
         $data['url'] = $url;
         Protocol::make_data($data);
         Protocol::output(4, 2);
     }
     global $arrAuthUser;
     $arrAuthUser = $_SESSION;
     /*-----------------------------[ 用户登录数据 ]-----------------------------[ begin ]---*
     		$arrAuthUser["account"] 		= $_SESSION["account"];
     		$arrAuthUser["player_id"]		= $_SESSION["player_id"];		//玩家ID
     		$arrAuthUser["player_name"]		= $_SESSION["player_name"];		//玩家昵称
     		$arrAuthUser["player_sex"]		= $_SESSION["player_sex"];		//玩家性别
     		$arrAuthUser["player_level"]	= $_SESSION["player_level"];	//玩家等级
     		$arrAuthUser["vip_level"]		= $_SESSION["vip_level"];		//vip等级
     		$arrAuthUser["avatar"]			= $_SESSION["avatar"];			//玩家avatar
     		$arrAuthUser["career_type"]		= $_SESSION["career_type"];			//玩家avatar编号
     		$arrAuthUser["city_id"]			= $_SESSION["city_id"];			//场景编号
     		$arrAuthUser["active_time"]		= $_SESSION["active_time"];		//活动时间
     		$arrAuthUser["logintime"]		= $_SESSION["logintime"];		//登录时间
     		$arrAuthUser["adult_flag"]		= $_SESSION["adult_flag"];		//防沉迷标志
     		$arrAuthUser["adult_game_time"]	= $_SESSION["adult_game_time"];	//防沉迷在线时间
     
     		/*
     		$arrAuthUser["adult_remind"]	= isset($_SESSION["adult_remind"]) ? $_SESSION["adult_remind"] : 0;//1:1小时,2:2小时,4:3小时
     		$arrAuthUser["online_reward_id"]	= $_SESSION["online_reward_id"];	//在线开始时间
     		$arrAuthUser["online_start_time"]	= $_SESSION["online_start_time"];	//在线开始时间
     		$arrAuthUser["online_reward_time"]	= $_SESSION["online_reward_time"];	//在线奖励时间
     		*/
     /*-----------------------------[ 用户登录数据 ]-----------------------------[ end ]---*/
 }