public function index() { $id = $this->_session('id'); $user = M('user'); $ulist = $user->find($id); $this->assign('ulist', $ulist); $testuser = M('testuser'); $tlist = $testuser->where('pid=' . $id)->find(); $this->assign('tlist', $tlist); $shiyong = M('shiyong'); $slist = $shiyong->where('pid=' . $id)->find(); $this->assign('slist', $slist); $bianhao = new UserViewModel(); $blist = $bianhao->where('pid=' . $id)->find(); $this->assign('blist', $blist); if ($slist['num'] == '' or $slist['home'] == '' or $slist['tsj'] == '' or $slist['xsq'] == '') { $a = '<b>修改设备编号</b>'; $this->assign('a', $a); } $this->display(); }
public function _initialize() { $config = M('config')->where('id=1')->find(); if ($config['site_status'] == 0) { $this->message3($config['close_reason']); } $current_moban = $config['site_template']; $_POST['t'] = $current_moban; $_GET['t'] = $current_moban; $this->assign('config', $config); $kongbao_config = json_decode($config['kongbao_config'], true); $this->assign('kongbao_config', $kongbao_config); $kongbao_page = json_decode($config['kongbao_page'], true); $danhao_config = json_decode($config['danhao_config'], true); $xiaohao_config = json_decode($config['xiaohao_config'], true); $this->assign('danhao_config', $danhao_config); $this->assign('xiaohao_config', $xiaohao_config); $reg_setting = json_decode($config['reg_setting'], true); $this->assign('reg_setting', $reg_setting); $qq_setting = json_decode($config['qq_setting'], true); $this->assign('qq_setting', $qq_setting); $sj_setting = json_decode($config['sj_setting'], true); $this->assign('sj_setting', $sj_setting); $kongbao_page_temp = array(); foreach ($kongbao_page as $key1 => $v1) { $kongbao_page_temp[$key1] = stripslashes(htmlspecialchars_decode($v1)); } $this->assign('kongbao_page', $kongbao_page_temp); $seo_seoo = json_decode($config['seo_seoo'], true); $seo_seoo_temp = array(); foreach ($seo_seoo as $key1 => $v1) { $seo_seoo_temp[$key1] = stripslashes(htmlspecialchars_decode($v1)); } $this->assign('seo_seoo', $seo_seoo_temp); $this->assign('seo_keyword', $config['metakeys']); $this->assign('seo_desc', $config['metadesc']); $this->assign('seo_title', $config['metatitle']); $rand_num = rand(1, 5); $header_adv = M('adv')->where('typeid=2')->order($rand_num)->find(); $adv_id = $header_adv['id']; $this->assign('header_adv', $header_adv); $rand_num = rand(1, 5); $header_adv1 = M('adv')->where('typeid=2 and id<>' . $adv_id)->order($rand_num)->find(); $this->assign('header_adv1', $header_adv1); $slide_list = M('adv')->where('typeid=1')->select(); $this->assign('slide_list', $slide_list); $footer_adv = M('adv')->where('typeid=3')->order($rand_num)->find(); $this->assign('footer_adv', $footer_adv); $kbhdp_list = M('adv')->where('typeid=4')->select(); $this->assign('kbhdp_list', $kbhdp_list); $loging_adv = M('adv')->where('typeid=5')->order($rand_num)->find(); $this->assign('loging_adv', $loging_adv); $loginj_adv = M('adv')->where('typeid=6')->order($rand_num)->find(); $this->assign('loginj_adv', $loginj_adv); $model = new Model('link'); $flink = $model->order('addtime asc')->select(); $this->assign('flink_list', $flink); $kefu_type_list = M('kefu_type')->order('sort_order asc')->select(); $kefu_list = array(); foreach ($kefu_type_list as $ktype => $kvalue) { $kefu_list[$kvalue['id']]['title'] = $kvalue['title']; $kf_list = M('kefu')->where('kf_type=' . $kvalue['id'])->order('sort_order asc')->select(); $kefu_list[$kvalue['id']]['data'] = $kf_list; } $this->assign('kefu_list', $kefu_list); if (session('IS_LOGIN') == 1) { $userid = session('userid'); $model = new UserViewModel(); $user = $model->where('user.id=' . $userid)->find(); $this->assign('user', $user); if (0 < $user['refer_id']) { $refer_qq = ''; $refer_user = M('user')->where('id=' . $user['refer_id'])->find(); if (!empty($refer_user)) { $refer_qq = $refer_user['user_qq']; } $this->assign('refer_qq', $refer_qq); } } }
public function edit() { $userid = I('id', 0); $type_model = new UserLevelModel(); $type_list = $type_model->order('sort_order asc')->select(); $this->assign('type_list', $type_list); if (0 < $userid) { $user = new UserViewModel(); $where['id'] = $userid; $data = $user->where($where)->find(); $cwsz_config = array(); if ($data['cwsz_config'] != '') { $cwsz_config = json_decode($data['cwsz_config'], true); } $this->assign('userdata', $data); $this->assign('cwsz_config', $cwsz_config); $this->display(); } else { $this->message('未指定任何用户信息', __URL__ . '/index'); } }
public function index() { $exp_time = time(); $exp_datetime = date('Y-m-d H:i:s', $exp_time); $config = M('config')->where('id=1')->find(); $tuiguang_url = 'http://' . $_SERVER['HTTP_HOST'] . __APP__ . '?ruid=' . session('userid'); if ($config['tuiguang_shorturl'] == 1) { if (!class_exists('Short_Url')) { require 'Public/Short_Url.php'; } $short_url = new Short_Url(); $tuiguang_url = $short_url->url_short($tuiguang_url); } $image_url = 'http://' . $_SERVER['HTTP_HOST'] . $config['tg_images']; $tg_content1 = ''; $tg_content2 = ''; $tg_content3 = ''; if ($config['tg_content1'] != '') { $tg_content1 = str_replace('{refer_url}', $tuiguang_url, $config['tg_content1']); } if ($config['tg_content2'] != '') { $tg_content2 = str_replace('{refer_url}', $tuiguang_url, $config['tg_content2']); } if ($config['tg_content3'] != '') { $tg_content3 = str_replace('{refer_url}', $tuiguang_url, $config['tg_content3']); } $this->assign('image_url', $image_url); $this->assign('tuiguang_url', $tuiguang_url); $this->assign('tg_content', array($tg_content1, $tg_content2, $tg_content3)); $refer_nums = D('user')->where('refer_id=' . session('userid'))->count(); $this->assign('refer_nums', $refer_nums); $reg_setting = M('user')->where('id=' . session('userid'))->find(); $wrefer_id = $reg_setting['refer_id']; $vip_setting = json_decode($reg_setting['vip_set'], true); $wrefer = M('user')->where('id=' . $wrefer_id)->find(); $wusername = $wrefer['username']; $this->assign('wusername', $wusername); $this->assign('vip_setting', $vip_setting); $refer_id = I('ruid', 0); if (0 < $refer_id) { $refer_user = M('user')->where('id=' . $refer_id)->find(); if (!empty($refer_user)) { $refer_user_type = $refer_user['user_type']; $user_level = M('user_level')->where('id=' . $refer_user_type)->find(); $level_config = json_decode($user_level['config'], true); if ($level_config['refer'] == 1) { $cruid = cookie('vgs-referid'); if (!$cruid) { cookie('vgs-referid', $refer_id, 604800); } } } } $model = new Model('gonggao'); $gonggao = $model->order('time desc')->limit(8)->select(); $this->assign('gonggao_list', $gonggao); $config = M('config')->where('id=1')->find(); $kongbao_config = json_decode($config['kongbao_config'], true); $model = new Model('kongbao_type'); $list = $model->where('is_true=0')->order('sort_order asc')->select(); $type_list = array(); foreach ($list as $k => $v) { if ($kongbao_config['stop_view'] == 0 && $v['state'] == 1) { continue; } if ($v['state'] == 0) { $v['name'] = $v['name'] . '(正常出售)'; } if ($v['state'] == 1) { $v['name'] = $v['name'] . '(暂停出售)'; } $v['config'] = json_decode($v['config'], true); $type_list[] = $v; } $this->assign('type_list', $type_list); $user = M('user')->where('id=' . $userid)->find(); $user_type = $user['user_type']; $user_default_kuaidi = $user['default_kuaidi']; $this->assign('user_default_kuaidi', $user_default_kuaidi); $config = M('config'); $setting = $config->where('id=1')->find(); $mibao_setting = json_decode($setting['mibao_setting'], true); $this->assign('mibao_setting', $mibao_setting); $cwsz_config = json_decode($this->user['cwsz_config'], true); $this->assign('cwsz_config', $cwsz_config); $model = new Model('help'); $help = $model->order('time desc')->limit(8)->select(); $this->assign('help_list', $help); $model = new Model('article'); $article = $model->order('article_time desc')->limit(8)->select(); $this->assign('article_list', $article); $model = new Model('about'); $about = $model->order('time desc')->limit(8)->select(); $this->assign('about_list', $about); $model = new UserOrderViewModel(); $where = array(); $where['type'] = 1; $where['status'] = 1; $recharge_list = $model->where($where)->order('addtime desc')->limit(100)->select(); $this->assign('recharge_list', $recharge_list); $where['type'] = 0; $where['status'] = 1; $pay_order_list = $model->where($where)->order('addtime desc')->limit(100)->select(); $this->assign('order_list', $pay_order_list); if (session('IS_LOGIN') == 1) { $userid = session('userid'); $model = new UserViewModel(); $user = $model->where('user.id=' . $userid)->find(); $this->assign('user', $user); } else { $sys_config = M('config')->where('id=1')->find(); $current_moban = $sys_config['site_template']; if ($current_moban == 'default' || $current_moban == 'longxiang' || $current_moban == 'php') { $this->display('index_login'); exit; } } $this->display(); }
public function _initialize() { /*$frequency=10; $period=60; $limitTime=600; $now=time(); $userId=session('userid'); $userId=$userId?:0; $clientIP = get_client_ip(); M('access_statistics')->where("time+$period<$now")->delete(); M('access_statistics')->add([ 'ip'=> $clientIP, 'time'=>$now, 'action'=>ACTION_NAME, 'user_id'=>$userId ]); $deny=M('access_deny')->where(['ip'=>$clientIP,"time>$now"])->find(); if($deny){ exit('deny'); } $limitActions=M('access_statistics')->query("select * from access_statistics group by ip,`action` having count(*)>{$frequency}"); foreach ($limitActions as $item){ M('access_deny')->add(['ip'=>$item['ip'],'time'=>$now+$limitTime],[],true); }*/ $_GET = array_map([$this, 'wdreplace'], $_GET); $_POST = array_map([$this, 'wdreplace'], $_POST); $config = M('config')->where('id=1')->find(); if ($config['site_status'] == 0) { $this->message3($config['close_reason']); } $current_moban = $config['site_template']; $_POST['t'] = $current_moban; $_GET['t'] = $current_moban; $this->assign('config', $config); $kongbao_config = json_decode($config['kongbao_config'], true); $this->assign('kongbao_config', $kongbao_config); $kongbao_page = json_decode($config['kongbao_page'], true); $danhao_config = json_decode($config['danhao_config'], true); $xiaohao_config = json_decode($config['xiaohao_config'], true); $this->assign('danhao_config', $danhao_config); $this->assign('xiaohao_config', $xiaohao_config); $reg_setting = json_decode($config['reg_setting'], true); $this->assign('reg_setting', $reg_setting); $qq_setting = json_decode($config['qq_setting'], true); $this->assign('qq_setting', $qq_setting); $sj_setting = json_decode($config['sj_setting'], true); $this->assign('sj_setting', $sj_setting); $kongbao_page_temp = array(); foreach ($kongbao_page as $key1 => $v1) { $kongbao_page_temp[$key1] = stripslashes(htmlspecialchars_decode($v1)); } $this->assign('kongbao_page', $kongbao_page_temp); $seo_seoo = json_decode($config['seo_seoo'], true); $seo_seoo_temp = array(); foreach ($seo_seoo as $key1 => $v1) { $seo_seoo_temp[$key1] = stripslashes(htmlspecialchars_decode($v1)); } $this->assign('seo_seoo', $seo_seoo_temp); $this->assign('seo_keyword', $config['metakeys']); $this->assign('seo_desc', $config['metadesc']); $this->assign('seo_title', $config['metatitle']); $rand_num = rand(1, 5); $header_adv = M('adv')->where('typeid=2')->order($rand_num)->find(); $adv_id = $header_adv['id']; $this->assign('header_adv', $header_adv); $rand_num = rand(1, 5); $header_adv1 = M('adv')->where('typeid=2 and id<>' . $adv_id)->order($rand_num)->find(); $this->assign('header_adv1', $header_adv1); $slide_list = M('adv')->where('typeid=1')->select(); $this->assign('slide_list', $slide_list); $footer_adv = M('adv')->where('typeid=3')->order($rand_num)->find(); $this->assign('footer_adv', $footer_adv); $kbhdp_list = M('adv')->where('typeid=4')->select(); $this->assign('kbhdp_list', $kbhdp_list); $loging_adv = M('adv')->where('typeid=5')->order($rand_num)->find(); $this->assign('loging_adv', $loging_adv); $loginj_adv = M('adv')->where('typeid=6')->order($rand_num)->find(); $this->assign('loginj_adv', $loginj_adv); $model = new Model('link'); $flink = $model->order('addtime asc')->select(); $this->assign('flink_list', $flink); $kefu_type_list = M('kefu_type')->order('sort_order asc')->select(); $kefu_list = array(); foreach ($kefu_type_list as $ktype => $kvalue) { $kefu_list[$kvalue['id']]['title'] = $kvalue['title']; $kf_list = M('kefu')->where('kf_type=' . $kvalue['id'])->order('sort_order asc')->select(); $kefu_list[$kvalue['id']]['data'] = $kf_list; } $this->assign('kefu_list', $kefu_list); if (session('IS_LOGIN') == 1) { $userid = session('userid'); $model = new UserViewModel(); $user = $model->where('user.id=' . $userid)->find(); $this->assign('user', $user); if (0 < $user['refer_id']) { $refer_qq = ''; $refer_user = M('user')->where('id=' . $user['refer_id'])->find(); if (!empty($refer_user)) { $refer_qq = $refer_user['user_qq']; } $this->assign('refer_qq', $refer_qq); } } }