Ejemplo n.º 1
0
 /**
  * 通过接口注册通用的方法
  * 
  * @param $user_name	用户名
  * @param $pwd			密码,做过base64编码
  * @param $poster		海报码
  * @param $realname	真实姓名
  * @param $identity	身份证
  * @param $email		邮箱
  */
 private function regCommon($user_name, $pwd, $poster = '', $realname = '', $identity = '', $email = '', $reg_from_id = 0)
 {
     //		$user_name = strtolower($user_name);
     $ip = getClientIP();
     //取站长信息
     $from_id = $_COOKIE[WEBMASTER];
     $game_id = $_COOKIE[AD_GAME_ID];
     $type = $_COOKIE[SPREAD_TYPE];
     $sub_code = $_COOKIE[SUB_CODE];
     $invite = $_COOKIE[INVITE];
     //调用Java接口 验证,取account_id.
     $regSign = md5($user_name . $pwd . REG_USER_KEY);
     $data = array('passport' => $user_name, 'password' => $pwd, 'ip' => $ip, 'realname' => $realname, 'idcard' => $identity, 'sign' => $regSign);
     $rereg = $this->get_request_file(REG_USER_URL, $data);
     $re_array = json_decode($rereg);
     if (empty($re_array) || $re_array[0]->result == 'fail') {
         return false;
         //注册失败
     }
     $account_id = $re_array[0]->account_id;
     //取站长推广有效期
     $period = 0;
     $cps_end_time = date('Y-m-d H:i:s');
     $this->loadModel('member_model');
     if ($type == 2) {
         //cps
         $union = $this->member_model->from('union_webmaster')->getOne('*', array('webmaster_id' => $from_id), UNION_ . $from_id, 3600 * 12);
         if ($union['status'] == 1) {
             $period = empty($union['share_month']) ? 0 : $union['share_month'];
         }
         //			$period = empty($union['share_month'])?0:$union['share_month'];
         $cps_end_time = date('Y-m-d', strtotime("+{$period}\tmonth"));
         if ($game_id == 14) {
             //炼狱世界发卡
             $this->getAndUseCard($game_id, $account_id, $user_name, $pwd, $ip);
         }
     }
     $week = date('N');
     $hour = date('H');
     $user = array('account_id' => $account_id, 'account' => $user_name, 'email' => $email, 'reg_ip' => $ip, 'reg_time' => date('Y-m-d H:i:s'), 'from_id' => empty($from_id) ? $reg_from_id : $from_id, 'game_id' => empty($game_id) ? 0 : $game_id, 'poster' => empty($poster) ? 0 : $poster, 'type' => empty($type) ? 0 : $type, 'period' => $period, 'cooper_id' => 0, 'sub_code' => empty($sub_code) ? 0 : $sub_code, 'cps_end_time' => $cps_end_time, 'week' => $week, 'hour' => $hour, 'invite' => empty($invite) ? 0 : $invite);
     $a = $this->member_model->from('account')->insert($user);
     $_SESSION['validn'] = '';
     $_SESSION[SESS_USER] = $user;
     $crypt_key = md5($user_name . time() . ENCRYPT_KEY);
     $inter_pwd = md5(strtoupper(md5(base64_decode($pwd))));
     $cookie_pwd = crypt_encode($inter_pwd, $crypt_key);
     //		log_info("member :".getClientIP()."\t".var_export($_SESSION[SESS_USER],true));
     setcookie(SDK, $crypt_key, time() + 3600 * 5, '/', DOMAIN);
     setcookie(SDU, crypt_encode($user_name, $crypt_key), time() + 3600 * 5, '/', DOMAIN);
     setcookie(SDP, $cookie_pwd, time() + 3600 * 5, '/', DOMAIN);
     //记录用户登陆 分流页用
     $other = json_encode(array('msg' => 'loginSucceed', 'result' => '', 'account_id' => $account_id, 'account' => $user_name));
     setcookie('servers', $other, time() + 1800, '/', '.51yx.com');
     //TODO 调用广告注册
     //		md5 = Constants.getMD5(Constants.JAVA_TO_PHP_KEY+svalue+registerIP+userName).substring(0,16).toLowerCase();
     //		url = new URL(" http://c.51yx.com/client/regdata.php?cid="+svalue+"&pp="+userName+"&ip="+registerIP+"&key="+md5);
     //		JAVA_TO_PHP_KEY = "!@#Condor)(*";
     $condor_adsys_id = $_COOKIE['condor_adsys_id'];
     if (!empty($condor_adsys_id)) {
         $adsys_pub_key = "!@#Condor)(*";
         $adsys_key = strtolower(substr(md5($adsys_pub_key . $condor_adsys_id . $ip . $user_name), 0, 16));
         $adsys_url = "http://c.51yx.com/client/regdata.php?cid={$condor_adsys_id}&pp={$user_name}&ip={$ip}&key={$adsys_key}";
         @$this->curl_request($adsys_url);
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * 注册通用的方法
  * @param $user_name 	用户名
  * @param $pwd		密码 已base64_encode (原始密码)
  * @param $realname	真实姓名
  * @param $idcard		身份证
  * @param $email		邮件
  * @param $from_id	来源
  * @param $ip			用户IP
  * @param $game_id	游戏ID
  * @param $sub_code	字站长
  */
 private function regCommon($user_name, $pwd, $realname = '', $idcard = '', $email = '', $from_id = '', $ip = '', $game_id = '', $sub_code = '')
 {
     //调用Java接口 验证,取account_id.
     $regSign = md5($user_name . $pwd . REG_USER_KEY);
     $data = array('passport' => $user_name, 'password' => $pwd, 'ip' => $ip, 'realname' => $realname, 'idcard' => $idcard, 'sign' => $regSign);
     $rereg = $this->get_request_file(REG_USER_URL, $data);
     $re_array = json_decode($rereg);
     if (empty($re_array) || $re_array[0]->result == 'fail') {
         return false;
         //注册失败
     }
     $account_id = $re_array[0]->account_id;
     $this->loadModel('member_model');
     $reg_time = date('Y-m-d H:i:s');
     $week = date('N');
     $hour = date('H');
     $user = array('account_id' => $account_id, 'account' => $user_name, 'email' => $email, 'reg_ip' => $ip, 'reg_time' => $reg_time, 'from_id' => empty($from_id) ? 0 : $from_id, 'game_id' => empty($game_id) ? 0 : $game_id, 'poster' => 0, 'type' => 0, 'period' => 0, 'cooper_id' => 0, 'sub_code' => empty($sub_code) ? 0 : $sub_code, 'cps_end_time' => $reg_time, 'week' => $week, 'hour' => $hour);
     $a = $this->member_model->from('account')->insert($user);
     $_SESSION[SESS_USER] = $user;
     $crypt_key = md5($user_name . time() . ENCRYPT_KEY);
     setcookie(SDK, $crypt_key, time() + 3600, '/', DOMAIN);
     setcookie(SDU, crypt_encode($user_name, $crypt_key), time() + 3600, '/', DOMAIN);
     setcookie(SDP, crypt_encode(md5(strtoupper(md5($pwd))), $crypt_key), time() + 3600, '/', DOMAIN);
     return true;
 }