剑零账号注册php
- <?php
- public function register_account()
- {
- $result = CURL("http;//127.0.0.1:6605/apps-state",null,'get');
- $resultapp = $this->cut_str("<AppName>AuthSrv2</AppName>","</App>",$result);
- $resultapp = $this->cut_str("<Epoch>","</Epoch>",$resultapp);
-
- $post = input('param.');
- $account = $post['account'];
- $password = $post['password'];
- if($account == '' || $password == ''){
- echo '{"code":500,"msg":"账号和密码不能为空"}';
- return;
- }
- $sign = $this->getTradeSign($post,$account.'e7938f087738953de75fb77d03de11e4');
- if($post['sign']!=$sign){
- echo '{"code":500,"msg":"签名错误"}';
- return;
- }
- $param=[
- 'loginName' => $account.'@ncsoft.com',
- 'userName' => $account,
- 'password' => $password,
- 'effectiveUntil' => '',
- 'loginNameValidated'=>1,
- 'userCenter' => 17,
- ];
- $addr = "http://127.0.0.1:6605/spawned/AuthSrv.1.".$resultapp."/test/create_account";
- $result = CURL($addr,$param,'get');
-
- if(strpos($result,'<Reply>') !== false){
- echo '{"code":10000,"msg":"注册成功"}';
- return;
- }
- $result_xml = xml_decode($result);
- $addr = "11";
- $msg = '注册失败'.$addr;
- if($result_xml['@attributes']['code']=='3043'){
- $msg = "已经有此账号";
- }
- if($result_xml['@attributes']['code']=='10'){
- $msg = "参数错误";
- }
- echo '{"code":500,"msg":'.$msg.$result.'}';
- return;
- }
复制代码
|