예제 #1
0
 function actionFpass()
 {
     if ($s = PL_Session::canStart()) {
         die('auth');
     }
     $now = $_SERVER['REQUEST_TIME'];
     if ($gtime = $s->getGtime() < $now - 5 * 36000) {
         die('链接已经过期,重新找回密码');
     }
     $lum = new model_LoginUser($s->getid());
     $d = $lum->get();
     if ($_POST['npass']) {
     }
     include $this->viewRoot . 'findpasspage.php';
 }
예제 #2
0
 function actionSl()
 {
     $pid = $_REQUEST['pid'];
     if (!$pid) {
         $pid = $_COOKIE['pid'];
     }
     if (!$pid) {
         $pid = 'wplayers' . mt_rand(1, 100);
     }
     setcookie('pid', $pid);
     $um = model_LoginUser::genbypid($pid, $isnew);
     $this->tailerView = $this->viewRoot . 'list.php';
     include $this->viewRoot . 'layout.php';
 }
예제 #3
0
 /**
  * 纵乐验证appstore账号密码
  * http://admin.appstore.dzm.playcrab.com/vms/index.php?mod=jsapi&action=CheckUser&username=1&password=1&sign=0f9018eac682fe9422910d97349932f3
  */
 public function actionCheckUser()
 {
     $sign = self::getParam('sign');
     $email = self::getParam('username');
     $params = $_POST;
     //$params = array('username'=>$_GET['username'],'password'=>$_GET['password']);
     //print_r($params);
     unset($params['sign']);
     $c_sign = self::sign($params, 'ares');
     if (empty($email) or empty($sign) or $sign != $c_sign) {
         self::showMsg(array('s' => StatusCode::invalid_siginature));
     }
     $um = model_LoginUser::searchUniq('email', $email);
     if (!empty($um)) {
         $pass = self::getParam('password');
         if (!$um->checkPass($pass)) {
             self::showMsg(array('s' => StatusCode::auth_failed, 'msg' => 'password error!'));
         }
     } else {
         self::showMsg(array('s' => StatusCode::auth_failed, 'msg' => 'password or username error!'));
     }
     //循环玩家所有分区取VIP 找到vip13就停止返回
     $uid = $um['_id'];
     $vip = 1;
     foreach ((array) $um['last_login_secs'] as $sec_k => $in_time) {
         $player = new model_Player($uid, $sec_k);
         $udata = $player->getFields(array('vip.lvl'));
         //echo $sec_k."-vip:".$vip['vip']['lvl']."<br>";
         $v = $udata['vip']['lvl'];
         if ($v >= 13) {
             $vip = $v;
             break;
         } elseif ($v > $vip) {
             $vip = $v;
         }
     }
     $result = array('pid' => $um['pid'], 'vip' => $vip);
     self::showMsg(array('s' => 'ok', 'data' => $result));
 }
예제 #4
0
 public function __construct()
 {
     $ser = $this;
     //读取请求之前,验证是否多点登录
     //在执行controller 逻辑之前判断
     self::rEvent('E_BCR', function () use($ser) {
         if ($_REQUEST['__noauth__'] == 1) {
             return;
         }
         $app = app();
         $sec = $app->getsec();
         $uid = $app->getuid();
         $um = new model_LoginUser($uid);
         $d = $um->get();
         if ($d['isban']) {
             exit(0);
         }
         //合服阻挡进入
         $filter_config = dzm_base::load_config('mergesec', 'prevent_enter');
         model_Util::preventEnter($filter_config, $sec, $uid);
         $cm = $app->vget('CM');
         $cc = $app->vget('CC');
         if ($app->vget('RESOVER')) {
             return;
         }
         $iccs = $app->vget('ICCS');
         $icms = $app->vget('ICMS');
         $skip_sig_check_method = $app->vget('skip_sig_check_method');
         $skip_sig_check_controller = $app->vget('skip_sig_check_controller');
         if (!isset($skip_sig_check_method[$cm]) && !isset($skip_sig_check_controller[$cc])) {
             // 验证数据签名
             $req =& $app->vget('REQARR');
             $ret = $ser->authSig($req);
             if ($ret) {
                 //glog::info(json_encode($ret),'sign');
                 //glog::info(json_encode($req),'sign');
                 $app->vset('RESARR', $ret);
                 $ser->finishResponse();
                 exit(0);
             }
         }
         //do nothing , 登陆,打点,都没有session
         if ($cc == 'System' || $cc == 'Statistic') {
             return;
         }
         if (isset($iccs[$cc]) || isset($icms[$cm])) {
             $app->vset('NOLOG', true);
             return;
         }
         $sess = $app['session'];
         if ($sess->isDupLogin()) {
             $app->vset('RESARR', array('s' => 'dup'));
             $ser->finishResponse();
             //
             exit(0);
         }
     });
     //退出之前,结果已经返回客户端
     self::rEvent('E_QUIT', function () {
         //记录日志,增加统计
         $app = app();
         $req =& $app->vget('REQARR');
         $res =& $app->vget('RESARR');
         $ss =& $app->vget('session');
         $uid = $app->getuid();
         $sec = $app->getsec();
         $ltime = $app->getltime();
         //本次登录时间
         $cm = $app->vget('CM');
         $s = $res['s'];
         $time = $_SERVER['REQUEST_TIME'];
         //全日志
         /* TODO 做个开关,只针对一小部分人开启全日志
         			$hour = date('Ymd',$time);
                     $request_end_time = microtime(true);
                     glog::detail($uid,$sec,$cm,$request_end_time-$app->request_start_time,$req,$res);
                     */
         if ($uid == 68321 || $uid == 5225) {
             $req['_SERVER'] = $_SERVER;
             glog::detail($uid, $sec, $cm, $request_end_time - $app->request_start_time, $req, $res);
         }
         //处理统计,
         //todo:实时统计的东西也放到这里来
         $stats =& $app->ref('STATS');
         if ($stats) {
             foreach ($stats as &$object) {
                 $object['_tm'] = $time;
                 $object['_sec'] = $sec;
                 $object['_u'] = $uid;
                 $object['_cm'] = $cm;
                 $object['_s'] = 'OK';
                 $object['_ver'] = P_VERSION;
                 $object['_lvl'] = $_SESSION['lvl'];
                 $object['_it'] = $_SESSION['init_time'];
                 $object['_vip'] = $_SESSION['vip'];
                 $object['istest'] = $_SESSION['istest'];
                 $object['_source'] = $_SESSION['source'];
                 try {
                     //                        model_OpLog::add($object);
                 } catch (Exception $ex) {
                     //error_log($ex->getMessage());
                     error_log("记录日志出错");
                     error_log(json_encode($object));
                 }
             }
             // scribe关闭连接
             try {
                 model_StatLog::close();
             } catch (Exception $ex) {
                 error_log("scribe日志关闭出错");
             }
             if ($s == 'OK') {
                 return;
             }
         }
         if (!$cm) {
             return;
         }
         //明确的设置了不记录log
         if ($app->vget('NOLOG')) {
             return;
         }
         if ($app->vget['DEBUG']) {
             error_log("session: " . print_r($_SESSION, true) . "\n", 3, LOG_ROOT . "/debug.log");
         }
         $logp =& $app->vget('LOGP');
         if (!$logp) {
             $logp =& $req['p'];
         }
         $logp['_cm'] = $cm;
         $logp['_u'] = $uid;
         $logp['_sec'] = $sec;
         $logp['_s'] = $s;
         $logp['_tm'] = $time;
         $logp['msg'] = $res['msg'];
         //			model_OpLog::add($logp);
     });
 }
예제 #5
0
 public function action_check_vip()
 {
     echo date('Y-m-d H:i:s') . "统计充值\n";
     // 读取所有的充值信息,计算每个账号的真实充值
     $mon = getApp()->getPaymentMongoConnection();
     $rows = $mon->find(array('status' => StatusCode::payment_finished, 'action' => 'recharge_gem'), array(), array('_tm' => 1));
     $payments = array();
     $payments_check = array();
     foreach ($rows as $r) {
         $uid = $r['_u'];
         $section_id = $r['_sec'];
         $payments_check[$section_id][$uid] += $r['agem'];
     }
     echo date('Y-m-d H:i:s') . "统计充值完毕\n";
     $maxuid = model_LoginUser::maxuid();
     for ($uid = $maxuid; $uid >= 1; $uid--) {
         $login_model = new model_LoginUser($uid);
         $login_model->get(array('pid' => 1, 'istest' => 1, 'secs' => 1, 'isdev' => 1, 'isban' => 1));
         $d = $login_model->doc();
         $pid = $d['pid'];
         $istest = $d['istest'] == 1 ? 'test' : '';
         $isdev = $d['isdev'] == 1 ? 'dev' : '';
         $isban = $d['isban'] == 1 ? 'enable' : 'disabled';
         if (empty($d['secs'])) {
             $d['secs'] = array();
         }
         foreach ($d['secs'] as $section_id => $timestamp) {
             $player = new model_Player($uid, $section_id);
             $data = $player->getFields(array('vip', 'gem', 'total_gem_added', 'total_gem_rewarded', 'total_gem_rewarded2', 'total_gem_used'));
             $gemorder_agem = $payments_check[$section_id][$uid];
             if ($gemorder_agem > 0 || $data['total_gem_added'] > 0 || $data['vip']['lvl'] > 4) {
                 $gemorder_cash = $gemorder_agem / 10;
                 $db_cash = $data['total_gem_added'] / 10;
                 if ($db_cash != $gemorder_cash) {
                     echo "E,{$pid},{$uid},{$section_id},{$istest},{$isdev},        ";
                     echo "{$data['vip']['lvl']}, {$gemorder_cash} != {$db_cash}    {$isban}\n";
                 } else {
                     //echo "O,$uid,$section_id\n";
                 }
             } else {
                 //echo "O,$uid,$section_id\n";
             }
         }
         if ($uid % 1000 == 0) {
             echo date('Y-m-d H:i:s') . "\t current uid: {$uid}\n";
         }
     }
 }