Ejemplo n.º 1
0
 public function save()
 {
     $this->begin();
     $params = $_POST;
     if (isset($params['enabled']) && $params['enabled'] == 1) {
         $ips = explode(PHP_EOL, $params['ips']);
         if (!$params['ips'] || empty($ips)) {
             $this->end(false, app::get('site')->_('ip列表不能为空'));
         }
         app::get('site')->setConf('desktop.whitelist.enabled', 1);
         $current_admin_ip = request::getClientIp();
         if (!in_array($current_admin_ip, $ips)) {
             $ips[] = $current_admin_ip;
         }
         app::get('site')->setConf('desktop.whitelist.ips', $ips);
         if (in_array($params['error_code'], array('403', '404'))) {
             app::get('site')->setConf('desktop.whitelist.error_code', $params['error_code']);
         } else {
             app::get('site')->setConf('desktip.whitelist.error_code', '403');
         }
     } else {
         app::get('site')->setConf('desktop.whitelist.enabled', 0);
     }
     $this->end(true, '设置成功');
 }
Ejemplo n.º 2
0
 private function __loginLog($msg)
 {
     $log['IP'] = request::getClientIp();
     $log['uname'] = input::get('uname');
     $log['msg'] = $msg;
     $log['HTTP_REFERER'] = $_SERVER['HTTP_REFERER'];
     $log['type'] = 'shopadmin';
     logger::info('ADMIN_LOGIN:' . var_export($log, 1));
 }
Ejemplo n.º 3
0
 public function listener_login($params)
 {
     $account_type = pamAccount::getAuthType('desktop');
     if ($account_type === $params['type'] && $params['member_id']) {
         $users = app::get('desktop')->model('users');
         if ($row = $users->getList('*', array('user_id' => $params['member_id']))) {
             $sdf['lastlogin'] = time();
             $sdf['lastip'] = request::getClientIp();
             $sdf['logincount'] = $row[0]['logincount'] + 1;
             $users->update($sdf, array('user_id' => $params['member_id']));
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * 记录平台操作日志
  *
  * @param $lang 日志语言包
  * @param $status 成功失败状态
  * @param $admin_name
  * @param $admin_id
  */
 protected final function adminlog($memo = '', $status = 1)
 {
     // 开启了才记录操作日志
     if (ADMIN_OPERATOR_LOG !== true) {
         return;
     }
     $queue_params = array('admin_userid' => $this->user->get_id(), 'admin_username' => $this->user->get_login_name(), 'created_time' => time(), 'memo' => $memo, 'status' => $status ? 1 : 0, 'router' => request::fullurl(), 'ip' => request::getClientIp());
     return system_queue::instance()->publish('system_tasks_adminlog', 'system_tasks_adminlog', $queue_params);
 }
Ejemplo n.º 5
0
 protected function gen_session_id()
 {
     return sha1(uniqid('', true) . request::getClientIp() . str_random(25) . microtime(true));
 }
Ejemplo n.º 6
0
 public function signUp($loginName, $password, $confirmedPassword)
 {
     return app::get('pam')->rpcCall('user.create', ['account' => $loginName, 'password' => $password, 'pwd_confirm' => $confirmedPassword, 'reg_ip' => request::getClientIp()], 'buyer');
 }