Example #1
0
 public function loginoutOp()
 {
     session_unset();
     session_destroy();
     uk86_setNcCookie('goodsnum', '', -3600);
     showDialog(L('login_logout_success'), '', 'succ', '', 2);
 }
Example #2
0
 public function logoutOp()
 {
     $this->recordSellerLog('注销成功');
     // 清除店铺消息数量缓存
     uk86_setNcCookie('storemsgnewnum' . $_SESSION['seller_id'], 0, -3600);
     session_destroy();
     uk86_redirect('index.php?act=seller_login');
 }
Example #3
0
 public function select_cityOp()
 {
     $city_id = intval($_GET['city_id']);
     if ($city_id != 0 && (!isset($this->groupbuy_vr_cities['name'][$city_id]) || !isset($this->groupbuy_vr_cities['parent'][$city_id]) || $this->groupbuy_vr_cities['parent'][$city_id] != 0)) {
         uk86_showMessage('该城市不存在,请选择其他城市');
     }
     uk86_setNcCookie('city_id', $city_id);
     uk86_redirect(uk86_urlShop('show_groupbuy', $_GET['back_op']));
 }
Example #4
0
 /**
  * U币礼品详细
  */
 public function pinfoOp()
 {
     $pid = intval($_GET['id']);
     if (!$pid) {
         showDialog(L('pointprod_parameter_error'), uk86_urlShop('pointshop', 'index'), 'error');
     }
     $model_pointprod = Model('pointprod');
     //查询兑换礼品详细
     $prodinfo = $model_pointprod->getOnlinePointProdInfo(array('pgoods_id' => $pid));
     if (empty($prodinfo)) {
         showDialog(L('pointprod_record_error'), uk86_urlShop('pointprod', 'plist'), 'error');
     }
     Tpl::output('prodinfo', $prodinfo);
     //更新礼品浏览次数
     $tm_tm_visite_pgoods = uk86_cookie('tm_visite_pgoods');
     $tm_tm_visite_pgoods = $tm_tm_visite_pgoods ? explode(',', $tm_tm_visite_pgoods) : array();
     if (!in_array($pid, $tm_tm_visite_pgoods)) {
         //如果已经浏览过该商品则不重复累计浏览次数
         $result = $model_pointprod->editPointProdViewnum($pid);
         if ($result['state'] == true) {
             //累加成功则cookie中增加该商品ID
             $tm_tm_visite_pgoods[] = $pid;
             uk86_setNcCookie('tm_visite_pgoods', implode(',', $tm_tm_visite_pgoods));
         }
     }
     //查询兑换信息
     $model_pointorder = Model('pointorder');
     $pointorderstate_arr = $model_pointorder->getPointOrderStateBySign();
     $where = array();
     $where['point_orderstate'] = array('neq', $pointorderstate_arr['canceled'][0]);
     $where['point_goodsid'] = $pid;
     $orderprod_list = $model_pointorder->getPointOrderAndGoodsList($where, '*', 0, 4, 'points_ordergoods.point_recid desc');
     if ($orderprod_list) {
         $buyerid_arr = array();
         foreach ($orderprod_list as $k => $v) {
             $buyerid_arr[] = $v['point_buyerid'];
         }
         $memberlist_tmp = Model('member')->getMemberList(array('member_id' => array('in', $buyerid_arr)), 'member_id,member_avatar');
         $memberlist = array();
         if ($memberlist_tmp) {
             foreach ($memberlist_tmp as $v) {
                 $memberlist[$v['member_id']] = $v;
             }
         }
         foreach ($orderprod_list as $k => $v) {
             $v['member_avatar'] = ($t = $memberlist[$v['point_buyerid']]['member_avatar']) ? UPLOAD_SITE_URL . DS . ATTACH_AVATAR . DS . $t : UPLOAD_SITE_URL . DS . ATTACH_COMMON . DS . C('default_user_portrait');
             $orderprod_list[$k] = $v;
         }
     }
     Tpl::output('orderprod_list', $orderprod_list);
     //热门U币兑换商品
     $recommend_pointsprod = $model_pointprod->getRecommendPointProd(5);
     Tpl::output('recommend_pointsprod', $recommend_pointsprod);
     $seo_param = array();
     $seo_param['name'] = $prodinfo['pgoods_name'];
     $seo_param['key'] = $prodinfo['pgoods_keywords'];
     $seo_param['description'] = $prodinfo['pgoods_description'];
     Model('seo')->type('point_content')->param($seo_param)->show();
     //分类导航
     $nav_link = array(0 => array('title' => L('homepage'), 'link' => SHOP_SITE_URL), 1 => array('title' => 'U币中心', 'link' => uk86_urlShop('pointshop', 'index')), 2 => array('title' => '兑换礼品详情'));
     Tpl::output('nav_link_list', $nav_link);
     Tpl::showpage('pointprod_info');
 }
Example #5
0
 /**
  * 退出
  */
 public function logoutOp()
 {
     uk86_setNcCookie('sys_key', '', -1, '', null);
     @header("Location: index.php");
     exit;
 }
Example #6
0
 /**
  * 系统后台 会员登录后 将会员验证内容写入对应cookie中
  *
  * @param string $name 用户名
  * @param int $id 用户ID
  * @return bool 布尔类型的返回结果
  */
 protected final function systemSetKey($user)
 {
     uk86_setNcCookie('sys_key', uk86_encrypt(serialize($user), MD5_KEY), 3600, '', null);
 }
Example #7
0
 /**
  * 删除批量站内信
  */
 public function dropbatchmsgOp()
 {
     $message_id = trim($_GET['message_id']);
     $drop_type = trim($_GET['drop_type']);
     if (!in_array($drop_type, array('msg_system', 'msg_seller')) || empty($message_id)) {
         showDialog(Uk86Language::uk86_get('home_message_delete_request_wrong'));
     }
     $messageid_arr = explode(',', $message_id);
     $messageid_str = '';
     if (!empty($messageid_arr)) {
         $messageid_str = "'" . implode("','", $messageid_arr) . "'";
     }
     $model_message = Model('message');
     $param = array('message_id_in' => $messageid_str);
     if ($drop_type == 'msg_system') {
         $param['message_type'] = '1';
         $param['from_member_id'] = '0';
     }
     if ($drop_type == 'msg_seller') {
         $param['message_type'] = '2';
     }
     $drop_state = $model_message->dropBatchMessage($param, $_SESSION['member_id']);
     if ($drop_state) {
         //更新未读站内信数量cookie值
         $cookie_name = 'msgnewnum' . $_SESSION['member_id'];
         $countnum = $model_message->countNewMessage($_SESSION['member_id']);
         uk86_setNcCookie($cookie_name, $countnum, 2 * 3600);
         //保存2小时
         showDialog(Uk86Language::uk86_get('home_message_delete_success'), 'reload', 'succ');
     } else {
         showDialog(Uk86Language::uk86_get('home_message_delete_fail'), '', 'error');
     }
 }
Example #8
0
 /**
  * 首页 话题列表
  */
 public function indexOp()
 {
     // 圈子信息
     $this->circleInfo();
     // 圈主和管理信息
     $this->manageList();
     // 会员信息
     $this->memberInfo();
     // sidebar相关
     $this->sidebar();
     $model = Model();
     // 话题列表
     $where = array();
     $where['circle_id'] = $this->c_id;
     $thc_id = intval($_GET['thc_id']);
     if ($thc_id > 0) {
         $where['thclass_id'] = $thc_id;
         Tpl::output('thc_id', $thc_id);
     }
     if (intval($_GET['cream']) == 1) {
         $where['is_digest'] = 1;
     }
     $theme_list = $model->table('circle_theme')->where($where)->order('is_stick desc,lastspeak_time desc')->page(20)->select();
     $theme_list = uk86_array_under_reset($theme_list, 'theme_id');
     Tpl::output('show_page', $model->showpage('2'));
     Tpl::output('theme_list', $theme_list);
     // 附件列表
     if (!empty($theme_list)) {
         $themeid_array = array_keys($theme_list);
         $affix_list = $model->table('circle_affix')->where(array('affix_type' => 1, 'theme_id' => array('in', $themeid_array)))->select();
         $affix_list = uk86_array_under_reset($affix_list, 'theme_id', 2);
         Tpl::output('affix_list', $affix_list);
     }
     // 今日话题数
     // 当天时间戳
     $year = date("Y");
     $month = date("m");
     $day = date("d");
     $dayBegin = mktime(0, 0, 0, $month, $day, $year);
     $todaythcount = $model->table('circle_theme')->where(array('theme_addtime' => array('egt', $dayBegin), 'circle_id' => $this->c_id))->count();
     Tpl::output('todaythcount', $todaythcount);
     //展示形式,默认以图文展示 list/preview
     if ($_GET['type'] != '') {
         $display_mode = $_GET['type'] == 'list' ? 'list' : 'preview';
         uk86_setNcCookie('circleDisplayMode', $display_mode, 30 * 24 * 60 * 60);
     } else {
         $display_mode = uk86_cookie('circleDisplayMode') ? uk86_cookie('circleDisplayMode') : 'preview';
     }
     Tpl::output('display_mode', $display_mode);
     // 话题分类
     $where = array();
     $where['circle_id'] = $this->c_id;
     $where['thclass_status'] = 1;
     $thclass_list = $model->table('circle_thclass')->where($where)->order('thclass_sort asc')->select();
     $thclass_list = uk86_array_under_reset($thclass_list, 'thclass_id');
     Tpl::output('thclass_list', $thclass_list);
     // Read Permission
     $readperm = $this->readPermissions($this->cm_info);
     Tpl::output('readperm', $readperm);
     Tpl::output('m_readperm', $this->m_readperm);
     $this->circleSEO($this->circle_info['circle_name']);
     // breadcrumb navigation
     $this->breadcrumd();
     Tpl::showpage('group');
 }
Example #9
0
 /**
  * 计算购物车总商品数和总金额
  * @param string $type 购物车信息保存类型 db,cookie
  * @param array $condition 只有登录后操作购物车表时才会用到该参数
  */
 public function getCartNum($type, $condition = array())
 {
     if ($type == 'db') {
         $cart_all_price = 0;
         $cart_goods = $this->listCart('db', $condition);
         $this->cart_goods_num = count($cart_goods);
         if (!empty($cart_goods) && is_array($cart_goods)) {
             foreach ($cart_goods as $val) {
                 $cart_all_price += $val['goods_price'] * $val['goods_num'];
             }
         }
         $this->cart_all_price = uk86_ncPriceFormat($cart_all_price);
     } elseif ($type == 'cookie') {
         $cart_str = get_magic_quotes_gpc() ? stripslashes(uk86_cookie('cart')) : uk86_cookie('cart');
         $cart_str = base64_decode(uk86_decrypt($cart_str));
         $cart_array = @unserialize($cart_str);
         $cart_array = !is_array($cart_array) ? array() : $cart_array;
         /*$cartGood=Array();
         		foreach($cart_array as $key=>$val){
         			if($val['goods_id']!=null){
         				array_push($cartGood,$val);
         			}
         		}*/
         $this->cart_goods_num = count($cart_array);
         $cart_all_price = 0;
         foreach ($cart_array as $v) {
             $cart_all_price += floatval($v['goods_price']) * intval($v['goods_num']);
         }
         $this->cart_all_price = $cart_all_price;
     }
     @uk86_setNcCookie('cart_goods_num', $this->cart_goods_num, 2 * 3600);
     return $this->cart_goods_num;
 }
Example #10
0
 /**
  * 提醒续费
  */
 public function remind_renewalOp()
 {
     $store_id = intval($_GET['store_id']);
     $store_info = Model('store')->getStoreInfoByID($store_id);
     if (!empty($store_info) && $store_info['store_end_time'] < TIMESTAMP + 864000 && uk86_cookie('remindRenewal' . $store_id) == null) {
         // 发送商家消息
         $param = array();
         $param['code'] = 'store_expire';
         $param['store_id'] = intval($_GET['store_id']);
         $param['param'] = array();
         Uk86QueueClient::push('sendStoreMsg', $param);
         uk86_setNcCookie('remindRenewal' . $store_id, 1, 86400 * 10);
         // 十天
         uk86_showMessage('消息发送成功');
     }
     uk86_showMessage('消息发送失败');
 }
Example #11
0
/**
 * 检测FORM是否提交
 * @param  $check_token 是否验证token
 * @param  $check_captcha 是否验证验证码
 * @param  $return_type 'alert','num'
 * @return boolean
 */
function uk86_chksubmit($check_token = false, $check_captcha = false, $return_type = 'alert')
{
    $submit = isset($_POST['form_submit']) ? $_POST['form_submit'] : $_GET['form_submit'];
    if ($submit != 'ok') {
        return false;
    }
    if ($check_token && !Uk86Security::uk86_checkToken()) {
        if ($return_type == 'alert') {
            showDialog('Token error!');
        } else {
            return -11;
        }
    }
    if ($check_captcha) {
        if (!uk86_checkSeccode($_POST['nchash'], $_POST['captcha'])) {
            uk86_setNcCookie('seccode' . $_POST['nchash'], '', -3600);
            if ($return_type == 'alert') {
                showDialog('验证码错误!');
            } else {
                return -12;
            }
        }
        uk86_setNcCookie('seccode' . $_POST['nchash'], '', -3600);
    }
    return true;
}
Example #12
0
 /**
  * 验证修改支付密码时的安全校验码
  */
 public function sendCodeByPaypwdOp()
 {
     $code = trim($_GET['code']);
     $verify_code = uk86_cookie('pay_code_' . $_SESSION['member_id']);
     if (empty($verify_code)) {
         exit(json_encode(array('state' => false, 'msg' => '操作超时或校验码已被使用,请重新获取校验码')));
     }
     if ($code == $verify_code) {
         uk86_setNcCookie('pay_code_' . $_SESSION['member_id'], '');
         exit(json_encode(array('state' => true, 'msg' => '校验码验证成功,可进行下一步操作', 'url' => 'index.php?act=wap_member_change&op=changePaypwdIndex')));
     } else {
         exit(json_encode(array('state' => false, 'msg' => '校验码错误,请重新获取校验码')));
     }
 }
Example #13
0
 /**
  * 清除对比栏
  */
 public function delcompareOp()
 {
     if (trim($_GET['gid']) == 'all') {
         $gid_arr = array();
     } else {
         $gids = uk86_cookie('comparegoods');
         $gid_arr = $gids ? explode(',', $gids) : array();
         $gid = intval($_GET['gid']);
         if ($gid > 0 && $gid_arr) {
             unset($gid_arr[array_search($gid, $gid_arr)]);
         }
     }
     $gid_str = $gid_arr ? implode(',', $gid_arr) : '';
     //更新cookie数据
     if ($gid_str) {
         uk86_setNcCookie('comparegoods', $gid_str);
     } else {
         uk86_setNcCookie('comparegoods', '', -3600);
     }
     exit(json_encode(array('done' => true, 'gid_str' => $gid_str)));
 }
Example #14
0
 /**
  * 产生随机数并判断奖品剩余个数
  * @param array $prizes
  * @param int 	$length
  * @param int 	$wheel_id
  * @return number
  */
 public function set_random($prizes, $length, $wheel_id)
 {
     $model = Model('wheel_lottery');
     $big_num = 10000000;
     $num = intval(rand(0, 999999999));
     $chance = 0;
     $prizes_all = 0;
     $add_true = false;
     $lottery_arr = array();
     $lottery_arr['member_name'] = $_SESSION['member_name'] ? $_SESSION['member_name'] : '未知';
     $lottery_arr['wheel_id'] = $wheel_id;
     $lottery_arr['lottery_time'] = time();
     foreach ($prizes as $k => $v) {
         $last_chance = $chance;
         $chance += $v['chance'];
         $size = $model->where(array('wheel_id' => $wheel_id, 'prize_name' => $v['name']))->count();
         if ($size <= $v['num'] && $v['num'] > 0 || $v['num'] == 0) {
             if ($k == 0) {
                 if ($num >= 0 && $num < $v['chance'] * $big_num) {
                     $lottery_arr['prize_name'] = $v['name'];
                     $lottery_arr['lottery_type'] = $v['give'];
                     if ($v['give'] > 0) {
                         $add_true = true;
                     }
                     $random = 1;
                 }
             } elseif ($k == $length - 1) {
                 if ($num < $big_num * 100 && $num >= $last_chance * $big_num) {
                     $lottery_arr['prize_name'] = $v['name'];
                     $lottery_arr['lottery_type'] = $v['give'];
                     if ($v['give'] > 0) {
                         $add_true = true;
                     }
                     $random = $length;
                 }
             } else {
                 if ($num < $chance * $big_num && $num >= $last_chance * $big_num) {
                     $lottery_arr['prize_name'] = $v['name'];
                     $lottery_arr['lottery_type'] = $v['give'];
                     if ($v['give'] > 0) {
                         $add_true = true;
                     }
                     $random = $k + 1;
                 }
             }
         } else {
             $random = $length;
         }
     }
     if ($add_true) {
         uk86_setNcCookie('lottery_type', $lottery_arr['lottery_type'], 100);
         //添加到奖品列表
         $model->insert($lottery_arr);
     }
     return $random;
 }
Example #15
0
 /**
  * 购物车删除单个商品,未登录前使用cart_id即为goods_id
  */
 public function delOp()
 {
     $cart_id = intval($_GET['cart_id']);
     if ($cart_id <= 0) {
         return;
     }
     $model_cart = Model('cart');
     $data = array();
     if ($_SESSION['member_id']) {
         //登录状态下删除数据库内容
         $delete = $model_cart->delCart('db', array('cart_id' => $cart_id, 'buyer_id' => $_SESSION['member_id']));
         if ($delete) {
             $data['state'] = 'true';
             $data['quantity'] = $model_cart->cart_goods_num;
             $data['amount'] = $model_cart->cart_all_price;
         } else {
             $data['msg'] = Uk86Language::uk86_get('cart_drop_del_fail', 'UTF-8');
         }
     } else {
         //未登录时删除cookie的购物车信息
         $delete = $model_cart->delCart('cookie', array('goods_id' => $cart_id));
         if ($delete) {
             $data['state'] = 'true';
             $data['quantity'] = $model_cart->cart_goods_num;
             $data['amount'] = $model_cart->cart_all_price;
         }
     }
     uk86_setNcCookie('cart_goods_num', $model_cart->cart_goods_num, 2 * 3600);
     $json_data = json_encode($data);
     if (isset($_GET['callback'])) {
         $json_data = $_GET['callback'] == '?' ? '(' . $json_data . ')' : $_GET['callback'] . "({$json_data});";
     }
     exit($json_data);
 }
Example #16
0
 /**
  * 登录时创建会话SESSION
  *
  * @param array $member_info 会员信息
  */
 public function createSession($member_info = array(), $reg = false)
 {
     if (empty($member_info) || !is_array($member_info)) {
         return;
     }
     $_SESSION['is_login'] = '******';
     $_SESSION['member_id'] = $member_info['member_id'];
     $_SESSION['member_name'] = $member_info['member_name'];
     $_SESSION['member_email'] = $member_info['member_email'];
     $_SESSION['is_buy'] = isset($member_info['is_buy']) ? $member_info['is_buy'] : 1;
     $_SESSION['avatar'] = $member_info['member_avatar'];
     $seller_info = Model('seller')->getSellerInfo(array('member_id' => $_SESSION['member_id']));
     $_SESSION['store_id'] = $seller_info['store_id'];
     if (trim($member_info['member_qqopenid'])) {
         $_SESSION['openid'] = $member_info['member_qqopenid'];
     }
     if (trim($member_info['member_sinaopenid'])) {
         $_SESSION['slast_key']['uid'] = $member_info['member_sinaopenid'];
     }
     if (!$reg) {
         //添加会员U币
         $this->addPoint($member_info);
         //添加会员经验值
         $this->addExppoint($member_info);
     }
     if (!empty($member_info['member_login_time'])) {
         $update_info = array('member_login_num' => $member_info['member_login_num'] + 1, 'member_login_time' => TIMESTAMP, 'member_old_login_time' => $member_info['member_login_time'], 'member_login_ip' => uk86_getIp(), 'member_old_login_ip' => $member_info['member_login_ip']);
         $this->editMember(array('member_id' => $member_info['member_id']), $update_info);
     }
     uk86_setNcCookie('cart_goods_num', '', -3600);
 }
Example #17
0
 /**
  * 统一身份验证入口
  */
 public function authOp()
 {
     $model_member = Model('member');
     if (uk86_chksubmit(false, true)) {
         if (!in_array($_POST['type'], array('modify_pwd', 'modify_mobile', 'modify_email', 'modify_paypwd', 'pd_cash'))) {
             uk86_redirect('index.php?act=member_security&op=index');
         }
         $member_common_info = $model_member->getMemberCommonInfo(array('member_id' => $_SESSION['member_id']));
         if (empty($member_common_info) || !is_array($member_common_info)) {
             uk86_showMessage('验证失败', '', 'html', 'error');
         }
         if ($member_common_info['auth_code'] != $_POST['auth_code'] || TIMESTAMP - $member_common_info['send_acode_time'] > 1800) {
             uk86_showMessage('验证码已被使用或超时,请重新获取验证码', '', 'html', 'error');
         }
         $data = array();
         $data['auth_code'] = '';
         $data['send_acode_time'] = 0;
         $update = $model_member->editMemberCommon($data, array('member_id' => $_SESSION['member_id']));
         if (!$update) {
             uk86_showMessage('系统发生错误,如有疑问请与管理员联系', SHOP_SITE_URL, 'html', 'error');
         }
         uk86_setNcCookie('seccode' . $_POST['nchash'], '', -3600);
         $_SESSION['auth_' . $_POST['type']] = TIMESTAMP;
         self::profile_menu($_POST['type'], $_POST['type']);
         if ($_POST['type'] == 'pd_cash') {
             Tpl::showpage('member_pd_cash.add');
         } else {
             Tpl::showpage('member_security.' . $_POST['type']);
         }
     } else {
         if (!in_array($_GET['type'], array('modify_pwd', 'modify_mobile', 'modify_email', 'modify_paypwd', 'pd_cash'))) {
             uk86_redirect('index.php?act=member_security&op=index');
         }
         //继承父类的member_info
         $member_info = $this->member_info;
         if (!$member_info) {
             $member_info = $model_member->getMemberInfo(array('member_id' => $_SESSION['member_id']), 'member_email,member_email_bind,member_mobile,member_mobile_bind');
         }
         self::profile_menu($_GET['type'], $_GET['type']);
         //第一次绑定邮箱,不用发验证码,直接进下一步
         //第一次绑定手机,不用发验证码,直接进下一步
         if ($_GET['type'] == 'modify_email' && $member_info['member_email_bind'] == '0' || $_GET['type'] == 'modify_mobile' && $member_info['member_mobile_bind'] == '0') {
             $_SESSION['auth_' . $_GET['type']] = TIMESTAMP;
             Tpl::showpage('member_security.' . $_GET['type']);
             exit;
         }
         //修改密码、设置支付密码时,必须绑定邮箱或手机
         if (in_array($_GET['type'], array('modify_pwd', 'modify_paypwd')) && $member_info['member_email_bind'] == '0' && $member_info['member_mobile_bind'] == '0') {
             uk86_showMessage('请先绑定邮箱或手机', 'index.php?act=member_security&op=index', 'html', 'error');
         }
         Tpl::output('member_info', $member_info);
         Tpl::showpage('member_security.auth');
     }
 }
Example #18
0
 /**
  * 商家消息数量
  */
 private function checkStoreMsg()
 {
     //判断cookie是否存在
     $cookie_name = 'storemsgnewnum' . $_SESSION['seller_id'];
     if (uk86_cookie($cookie_name) != null && intval(uk86_cookie($cookie_name)) >= 0) {
         $countnum = intval(uk86_cookie($cookie_name));
     } else {
         $where = array();
         $where['store_id'] = $_SESSION['store_id'];
         $where['sm_readids'] = array('notlike', '%,' . $_SESSION['seller_id'] . ',%');
         if ($_SESSION['seller_smt_limits'] !== false) {
             $where['smt_code'] = array('in', $_SESSION['seller_smt_limits']);
         }
         $countnum = Model('store_msg')->getStoreMsgCount($where);
         uk86_setNcCookie($cookie_name, intval($countnum), 2 * 3600);
         //保存2小时
     }
     Tpl::output('store_msg_num', $countnum);
 }
Example #19
0
 /**
  * 添加评论(访客登录后操作)
  */
 public function addcommentOp()
 {
     // 验证用户是否登录
     $this->checkLoginStatus();
     $stid = intval($_POST['stid']);
     if ($stid <= 0) {
         showDialog(Uk86Language::uk86_get('wrong_argument'), '', 'error');
     }
     $obj_validate = new Uk86Validate();
     $validate_arr[] = array("input" => $_POST["commentcontent"], "require" => "true", "message" => Uk86Language::uk86_get('sns_comment_null'));
     $validate_arr[] = array("input" => $_POST["commentcontent"], "validator" => 'Length', "min" => 0, "max" => 140, "message" => Uk86Language::uk86_get('sns_content_beyond'));
     //评论数超过最大次数出现验证码
     if (intval(uk86_cookie('commentnum')) >= self::MAX_RECORDNUM) {
         $validate_arr[] = array("input" => $_POST["captcha"], "require" => "true", "message" => Uk86Language::uk86_get('wrong_null'));
     }
     $obj_validate->validateparam = $validate_arr;
     $error = $obj_validate->uk86_validate();
     if ($error != '') {
         showDialog($error, '', 'error');
     }
     //发帖数超过最大次数出现验证码
     if (intval(uk86_cookie('commentnum')) >= self::MAX_RECORDNUM) {
         if (!uk86_checkSeccode($_POST['nchash'], $_POST['captcha'])) {
             showDialog(Uk86Language::uk86_get('wrong_checkcode'), '', 'error');
         }
     }
     // 		//查询会员信息
     $model = Model();
     $member_info = $model->table('member')->where(array('member_state' => 1))->find($_SESSION['member_id']);
     if (empty($member_info)) {
         showDialog(Uk86Language::uk86_get('sns_member_error'), '', 'error');
     }
     $insert_arr = array();
     $insert_arr['strace_id'] = $stid;
     $insert_arr['scomm_content'] = $_POST['commentcontent'];
     $insert_arr['scomm_memberid'] = $member_info['member_id'];
     $insert_arr['scomm_membername'] = $member_info['member_name'];
     $insert_arr['scomm_memberavatar'] = $member_info['member_avatar'];
     $insert_arr['scomm_time'] = time();
     $result = Model('store_sns_comment')->saveStoreSnsComment($insert_arr);
     if ($result) {
         // 原帖增加评论次数
         $where = array('strace_id' => $stid);
         $update = array('strace_comment' => array('exp', 'strace_comment+1'));
         $rs = Model('store_sns_tracelog')->editStoreSnsTracelog($update, $where);
         //建立cookie
         if (uk86_cookie('commentnum') != null && intval(uk86_cookie('commentnum')) > 0) {
             uk86_setNcCookie('commentnum', intval(uk86_cookie('commentnum')) + 1, 2 * 3600);
             //保存2小时
         } else {
             uk86_setNcCookie('commentnum', 1, 2 * 3600);
             //保存2小时
         }
         $js = "\$('#content_comment" . $stid . "').html('');";
         if ($_POST['showtype'] == 1) {
             $js .= "\$('#tracereply_" . $stid . "').load('index.php?act=store_snshome&op=commenttop&id=" . $stid . "');";
         } else {
             $js .= "\$('#tracereply_" . $stid . "').load('index.php?act=store_snshome&op=commentlist&id=" . $stid . "');";
         }
         showDialog(Uk86Language::uk86_get('sns_comment_succ'), '', 'succ', $js);
     }
 }
Example #20
0
 /**
  * 退出登录操作
  */
 public function login_outOp()
 {
     uk86_setNcCookie('msgnewnum' . $_SESSION['member_id'], '', -3600);
     session_unset();
     session_destroy();
     uk86_setNcCookie('cart_goods_num', '', -3600);
     $url = uk86_getReferer();
     uk86_redirect('index.php?act=wap_login&op=login&url=' . $url);
 }
Example #21
0
 /**
  * 话题回复保存
  */
 public function save_replyOp()
 {
     // Reply function does close,throw error.
     if (!intval(C('circle_istalk'))) {
         showDialog(L('circle_has_been_closed_reply'));
     }
     // checked cookie of SEC
     if (uk86_cookie(circle_intervaltime)) {
         showDialog(L('circle_operation_too_frequent'));
     }
     // 会员信息
     $this->memberInfo();
     // 不是圈子成员不能发帖
     if (!in_array($this->identity, array(1, 2, 3))) {
         showDialog(L('circle_no_join_ban_reply'));
     }
     // 话题信息
     $this->themeInfo();
     if (uk86_chksubmit()) {
         /**
          * 验证
          */
         $obj_validate = new Uk86Validate();
         $obj_validate->validateparam = array(array("input" => $_POST["replycontent"], "require" => "true", "message" => L('circle_reply_not_null')));
         $error = $obj_validate->uk86_validate();
         if ($error != '') {
             showDialog($error);
         } else {
             $model = Model();
             $insert = array();
             $insert['theme_id'] = $this->t_id;
             $insert['circle_id'] = $this->c_id;
             $insert['member_id'] = $_SESSION['member_id'];
             $insert['member_name'] = $_SESSION['member_name'];
             $insert['reply_content'] = circleCenterCensor($_POST['replycontent']);
             $insert['reply_addtime'] = time();
             $insert['is_closed'] = 0;
             // 回复楼层验证
             if ($_POST['answer_id'] != '') {
                 $reply_info = Model()->table('circle_threply')->where(array('theme_id' => $this->t_id, 'reply_id' => intval($_POST['answer_id'])))->find();
                 if (!empty($reply_info)) {
                     $insert['reply_replyid'] = $reply_info['reply_id'];
                     $insert['reply_replyname'] = $reply_info['member_name'];
                 }
             }
             $reply_id = $model->table('circle_threply')->insert($insert);
             if ($reply_id) {
                 if ($_GET['type'] == 'adv') {
                     // 插入话题商品
                     if (!empty($_POST['goods'])) {
                         $goods_insert = array();
                         foreach ($_POST['goods'] as $key => $val) {
                             $p = array();
                             $p['theme_id'] = $this->t_id;
                             $p['reply_id'] = $reply_id;
                             $p['circle_id'] = $this->c_id;
                             $p['goods_id'] = $val['id'];
                             $p['goods_name'] = $val['name'];
                             $p['goods_price'] = $val['price'];
                             $p['goods_image'] = $val['image'];
                             $p['store_id'] = $val['storeid'];
                             $p['thg_type'] = $val['type'];
                             $p['thg_url'] = $val['type'] == 1 ? $val['uri'] : '';
                             $goods_insert[] = $p;
                         }
                         $rs = $model->table('circle_thg')->insertAll($goods_insert);
                     }
                     // 更新话题附件
                     $model->table('circle_affix')->where(array('affix_type' => 2, 'member_id' => $_SESSION['member_id'], 'reply_id' => 0))->update(array('theme_id' => $this->t_id, 'reply_id' => $reply_id, 'circle_id' => $this->c_id));
                 }
                 // 话题被回复数增加 最后发言人发言时间
                 $update = array();
                 $update['theme_id'] = $this->t_id;
                 $update['theme_commentcount'] = array('exp', 'theme_commentcount+1');
                 $update['lastspeak_id'] = $_SESSION['member_id'];
                 $update['lastspeak_name'] = $_SESSION['member_name'];
                 $update['lastspeak_time'] = time();
                 $model->table('circle_theme')->update($update);
                 // 成员回复数增加 最后回复时间
                 $model->table('circle_member')->where(array('member_id' => $_SESSION['member_id'], 'circle_id' => $this->c_id))->update(array('cm_comcount' => array('exp', 'cm_comcount+1'), 'cm_lastspeaktime' => time()));
                 // set cookie of SEC
                 if (intval(C('circle_intervaltime')) > 0) {
                     uk86_setNcCookie('circle_intervaltime', true, intval(C('circle_intervaltime')));
                 }
                 if ($this->theme_info['member_id'] != $_SESSION['member_id']) {
                     // Experience for replyer
                     $param = array();
                     $param['member_id'] = $_SESSION['member_id'];
                     $param['member_name'] = $_SESSION['member_name'];
                     $param['circle_id'] = $this->c_id;
                     $param['theme_id'] = $this->t_id;
                     $param['type'] = 'reply';
                     $param['itemid'] = $this->t_id . ',' . $reply_id;
                     Model('circle_exp')->saveExp($param);
                     // Experience for releaser
                     $param = array();
                     $param['member_id'] = $this->theme_info['member_id'];
                     $param['member_name'] = $this->theme_info['member_name'];
                     $param['theme_id'] = $this->t_id;
                     $param['circle_id'] = $this->c_id;
                     $param['type'] = 'replied';
                     $param['itemid'] = $this->t_id;
                     Model('circle_exp')->saveExp($param);
                 }
                 if ($_GET['type'] == 'quick') {
                     showDialog(L('nc_common_op_succ'), '', 'succ', '$(\'li[nctype="li' . $this->t_id . '"]\').find(\'.quick-reply-2\').removeClass(\'t\').html(\'\').end().find(\'.quick-reply-list-2\').remove().end().end().find(\'a[nctype="reply"]\').click().click();');
                 } else {
                     showDialog(L('nc_common_op_succ'), 'index.php?act=theme&op=theme_detail&c_id=' . $this->c_id . '&t_id=' . $this->t_id, 'succ');
                 }
             }
         }
     }
 }
Example #22
0
 /**
  * AJAX删除消息
  */
 public function del_msgOp()
 {
     // 验证参数
     $smids = $_GET['smids'];
     if (!preg_match('/^[\\d,]+$/i', $smids)) {
         showDialog(L('para_error'), '', 'error');
     }
     $smid_array = explode(',', $smids);
     // 验证是否为管理员
     if (!$this->checkIsAdmin()) {
         showDialog(L('para_error'), '', 'error');
     }
     $where = array();
     $where['store_id'] = $_SESSION['store_id'];
     $where['sm_id'] = array('in', $smid_array);
     // 删除消息记录
     Model('store_msg')->delStoreMsg($where);
     // 删除阅读记录
     unset($where['store_id']);
     Model('store_msg_read')->delStoreMsgRead($where);
     // 清除店铺消息数量缓存
     uk86_setNcCookie('storemsgnewnum' . $_SESSION['seller_id'], 0, -3600);
     showDialog(L('nc_common_op_succ'), 'reload', 'succ');
 }
Example #23
0
 /**
  * 添加转发
  */
 public function addforwardOp()
 {
     $obj_validate = new Uk86Validate();
     $originalid = intval($_POST["originalid"]);
     $validate_arr[] = array("input" => $originalid, "require" => "true", 'validator' => 'Compare', "operator" => ' > ', 'to' => 0, "message" => Uk86Language::uk86_get('sns_forward_fail'));
     $validate_arr[] = array("input" => $_POST["forwardcontent"], "validator" => 'Length', "min" => 0, "max" => 140, "message" => Uk86Language::uk86_get('sns_content_beyond'));
     //发帖数超过最大次数出现验证码
     if (intval(uk86_cookie('forwardnum')) >= self::MAX_RECORDNUM) {
         $validate_arr[] = array("input" => $_POST["captcha"], "require" => "true", "message" => Uk86Language::uk86_get('wrong_null'));
     }
     $obj_validate->validateparam = $validate_arr;
     $error = $obj_validate->uk86_validate();
     if ($error != '') {
         showDialog($error, '', 'error');
     }
     //发帖数超过最大次数出现验证码
     if (intval(uk86_cookie('forwardnum')) >= self::MAX_RECORDNUM) {
         if (!uk86_checkSeccode($_POST['nchash'], $_POST['captcha'])) {
             showDialog(Uk86Language::uk86_get('wrong_checkcode'), '', 'error');
         }
     }
     //查询会员信息
     $member_model = Model('member');
     $member_info = $member_model->getMemberInfo(array('member_id' => $_SESSION['member_id'], 'member_state' => 1));
     if (empty($member_info)) {
         showDialog(Uk86Language::uk86_get('sns_member_error'), '', 'error');
     }
     //查询原帖信息
     $tracelog_model = Model('sns_tracelog');
     $tracelog_info = $tracelog_model->getTracelogRow(array('trace_id' => "{$originalid}", 'trace_state' => "0"));
     if (empty($tracelog_info)) {
         showDialog(Uk86Language::uk86_get('sns_forward_fail'), '', 'error');
     }
     $insert_arr = array();
     $insert_arr['trace_originalid'] = $tracelog_info['trace_originalid'] > 0 ? $tracelog_info['trace_originalid'] : $originalid;
     //如果被转发的帖子为原帖的话,那么为原帖ID;如果被转发的帖子为转帖的话,那么为该转帖的原帖ID(即最初始帖子ID)
     $insert_arr['trace_originalmemberid'] = $tracelog_info['trace_originalid'] > 0 ? $tracelog_info['trace_originalmemberid'] : $tracelog_info['trace_memberid'];
     $insert_arr['trace_memberid'] = $_SESSION['member_id'];
     $insert_arr['trace_membername'] = $_SESSION['member_name'];
     $insert_arr['trace_memberavatar'] = $member_info['member_avatar'];
     $insert_arr['trace_title'] = $_POST['forwardcontent'] ? $_POST['forwardcontent'] : Uk86Language::uk86_get('sns_forward');
     if ($tracelog_info['trace_originalid'] > 0 || $tracelog_info['trace_from'] != 1) {
         $insert_arr['trace_content'] = addslashes($tracelog_info['trace_content']);
     } else {
         $content_str = "<div class=\"title\"><a href=\"%siteurl%index.php?act=member_snshome&mid={$tracelog_info['trace_memberid']}\" target=\"_blank\" class=\"uname\">{$tracelog_info['trace_membername']}</a>";
         $content_str .= Uk86Language::uk86_get('nc_colon') . "{$tracelog_info['trace_title']}</div>";
         $content_str .= addslashes($tracelog_info['trace_content']);
         $insert_arr['trace_content'] = $content_str;
     }
     $insert_arr['trace_addtime'] = time();
     $insert_arr['trace_state'] = '0';
     if ($tracelog_info['trace_privacy'] > 0) {
         $insert_arr['trace_privacy'] = 2;
         //因为动态可见权限跟转帖功能,本身就是矛盾的,为了防止可见度无法控制,所以如果原帖不为所有人可见,那么转帖的动态权限就为仅自己可见,否则为所有人可见
     } else {
         $insert_arr['trace_privacy'] = 0;
     }
     $insert_arr['trace_commentcount'] = 0;
     $insert_arr['trace_copycount'] = 0;
     $insert_arr['trace_orgcommentcount'] = $tracelog_info['trace_orgcommentcount'];
     $insert_arr['trace_orgcopycount'] = $tracelog_info['trace_orgcopycount'];
     $result = $tracelog_model->tracelogAdd($insert_arr);
     if ($result) {
         //更新动态转发次数
         $tracelog_model = Model('sns_tracelog');
         $update_arr = array();
         $update_arr['trace_copycount'] = array('sign' => 'increase', 'value' => '1');
         $update_arr['trace_orgcopycount'] = array('sign' => 'increase', 'value' => '1');
         $condition = array();
         //原始贴和被转帖都增加转帖次数
         if ($tracelog_info['trace_originalid'] > 0) {
             $condition['traceid_in'] = "{$tracelog_info['trace_originalid']}','{$originalid}";
         } else {
             $condition['trace_id'] = "{$originalid}";
         }
         $tracelog_model->tracelogEdit($update_arr, $condition);
         unset($condition);
         //更新所有转帖的原帖转发次数
         $condition = array();
         //原始贴和被转帖都增加转帖次数
         if ($tracelog_info['trace_originalid'] > 0) {
             $condition['trace_originalid'] = "{$tracelog_info['trace_originalid']}";
         } else {
             $condition['trace_originalid'] = "{$originalid}";
         }
         $tracelog_model->tracelogEdit(array('trace_orgcopycount' => $tracelog_info['trace_orgcopycount'] + 1), $condition);
         if ($_GET['irefresh']) {
             //建立cookie
             if (uk86_cookie('forwardnum') != null && intval(uk86_cookie('forwardnum')) > 0) {
                 uk86_setNcCookie('forwardnum', intval(uk86_cookie('forwardnum')) + 1, 2 * 3600);
                 //保存2小时
             } else {
                 uk86_setNcCookie('forwardnum', 1, 2 * 3600);
                 //保存2小时
             }
             if ($_GET['type'] == 'home') {
                 $js = "\$('#friendtrace').lazyshow({url:\"index.php?act=member_snshome&op=tracelist&mid={$tracelog_info['trace_memberid']}&curpage=1\",'iIntervalId':true});";
             } else {
                 if ($_GET['type'] == 'snshome') {
                     $js = "\$('#forward_" . $originalid . "').hide();\$('#friendtrace').lazyshow({url:\"index.php?act=member_snshome&op=tracelist&mid={$tracelog_info['trace_memberid']}&curpage=1\",'iIntervalId':true});";
                 } else {
                     $js = "\$('#friendtrace').lazyshow({url:\"index.php?act=member_snsindex&op=tracelist&curpage=1\",'iIntervalId':true});";
                 }
             }
             showDialog(Uk86Language::uk86_get('sns_forward_succ'), '', 'succ', $js);
         } else {
             showDialog(Uk86Language::uk86_get('sns_forward_succ'), '', 'succ');
         }
     } else {
         showDialog(Uk86Language::uk86_get('sns_forward_fail'), '', 'error');
     }
 }
Example #24
0
 /**
  * 实物商品 购物车、直接购买第一步:选择收获地址和配送方式
  */
 public function buy_step1Op()
 {
     header('Content-type:text/html; charset=utf-8');
     $buy_post = uk86_cookie('buy_post');
     if (!empty($_GET['addr_id']) && intval($_GET['addr_id']) > 0) {
         $_POST = unserialize(uk86_cookie('buy_post'));
         if (empty($_POST['cart_id'])) {
             $this->wap_showDialog('数据有变更,请重新下单', 'error', 'index.php?act=wap_index');
         }
     } elseif (empty($buy_post) && empty($_POST['cart_id'])) {
         $this->wap_showDialog('数据有变更,请重新下单', 'error', 'index.php?act=wap_index');
     }
     if ($_POST['step1_url'] != '') {
         $refrun_url = $_POST['step1_url'];
         uk86_setNcCookie('step1_refrun_url', $_POST['step1_url']);
     } else {
         $refrun_url = uk86_cookie('step1_refrun_url');
     }
     Tpl::output('refrun_url', $refrun_url);
     //虚拟商品购买分流
     if ($_POST['store_mention'] == 1) {
         $this->_buy_branch($_POST);
     }
     //门店自提标示
     Tpl::output('store_mention', $_POST['store_mention']);
     //得到购买数据
     $logic_buy = uk86_Logic('buy');
     $result = $logic_buy->buyStep1($_POST['cart_id'], $_POST['ifcart'], $_SESSION['member_id'], $_SESSION['store_id']);
     if (!$result['state']) {
         $this->wap_showDialog($result['msg'], 'error', 'index.php?act=wap_index');
     } else {
         $result = $result['data'];
     }
     //商品金额计算(分别对每个商品/优惠套装小计、每个店铺小计)
     Tpl::output('store_cart_list', $result['store_cart_list']);
     Tpl::output('store_goods_total', $result['store_goods_total']);
     //取得店铺优惠 - 满即送(赠品列表,店铺满送规则列表)
     Tpl::output('store_premiums_list', $result['store_premiums_list']);
     Tpl::output('store_mansong_rule_list', $result['store_mansong_rule_list']);
     //返回店铺可用的代金券
     Tpl::output('store_voucher_list', $result['store_voucher_list']);
     //返回需要计算运费的店铺ID数组 和 不需要计算运费(满免运费活动的)店铺ID及描述
     Tpl::output('need_calc_sid_list', $result['need_calc_sid_list']);
     Tpl::output('cancel_calc_sid_list', $result['cancel_calc_sid_list']);
     //将商品ID、数量、运费模板、运费序列化,加密,输出到模板,选择地区AJAX计算运费时作为参数使用
     Tpl::output('freight_hash', $result['freight_list']);
     //输出用户收货地址
     if (!empty($_GET['addr_id']) && intval($_GET['addr_id']) > 0) {
         $address_info = Model('address')->field('*')->where(array('address_id' => $_GET['addr_id']))->find();
         Tpl::output('address_info', $address_info);
     } else {
         Tpl::output('address_info', $result['address_info']);
     }
     //输出有货到付款时,在线支付和货到付款及每种支付下商品数量和详细列表
     Tpl::output('pay_goods_list', $result['pay_goods_list']);
     Tpl::output('ifshow_offpay', $result['ifshow_offpay']);
     Tpl::output('deny_edit_payment', $result['deny_edit_payment']);
     //不提供增值税发票时抛出true(模板使用)
     Tpl::output('vat_deny', $result['vat_deny']);
     //增值税发票哈希值(php验证使用)
     Tpl::output('vat_hash', $result['vat_hash']);
     //输出默认使用的发票信息
     Tpl::output('inv_info', $result['inv_info']);
     //显示预存款、支付密码、充值卡
     Tpl::output('available_pd_amount', $result['available_predeposit']);
     Tpl::output('member_paypwd', $result['member_paypwd']);
     Tpl::output('available_rcb_amount', $result['available_rc_balance']);
     //删除购物车无效商品
     $logic_buy->delCart($_POST['ifcart'], $_SESSION['member_id'], $_POST['invalid_cart']);
     //标识购买流程执行步骤
     Tpl::output('buy_step', 'step2');
     Tpl::output('ifcart', $_POST['ifcart']);
     //店铺信息
     $store_list = Model('store')->getStoreMemberIDList(array_keys($result['store_cart_list']));
     Tpl::output('store_list', $store_list);
     if (intval($_POST['store_mention']) == 2) {
         $n = strpos($_POST['cart_id'][0], '|');
         $goods_id = substr($_POST['cart_id'][0], 0, $n);
         $goods_mentioning = Model('goods')->where(array('goods_id' => $goods_id))->field('store_mentioning, store_id')->find();
         //Tpl::output('mentioning', $goods_mentioning['store_mentioning']);
         //输出店铺信息
         $store_info = Model('store')->where(array('store_id' => intval($goods_mentioning['store_id'])))->field('live_store_name, live_store_address, live_store_tel, live_store_bus')->find();
         Tpl::output('store_info', $store_info);
     }
     //post数据存入cookie
     //$_COOKIE['buy_post'] = $_POST;
     uk86_setNcCookie('buy_post', serialize($_POST));
     Tpl::showpage('buy_step1');
 }
Example #25
0
 /**
  * 订单后续其它处理
  *
  */
 private function _createOrderStep6()
 {
     $ifcart = $this->_post_data['ifcart'];
     $goods_buy_quantity = $this->_order_data['goods_buy_quantity'];
     $input_voucher_list = $this->_order_data['input_voucher_list'];
     $store_cart_list = $this->_order_data['store_cart_list'];
     $input_buy_items = $this->_order_data['input_buy_items'];
     $order_list = $this->_order_data['order_list'];
     $input_address_info = $this->_order_data['input_address_info'];
     $notice_list = $this->_order_data['notice_list'];
     $fc_id = $this->_order_data['fc_id'];
     $ifgroupbuy = $this->_order_data['ifgroupbuy'];
     //变更库存和销量
     Uk86QueueClient::push('createOrderUpdateStorage', $goods_buy_quantity);
     //更新使用的卡券包状态
     if (!empty($input_voucher_list) && is_array($input_voucher_list)) {
         Uk86QueueClient::push('editVoucherState', $input_voucher_list);
     }
     //更新F码使用状态
     if ($fc_id) {
         Model('free')->where(array('fcode_id' => $fc_id))->update(array('free_state' => 1));
         Uk86QueueClient::push('updateGoodsFCode', $fc_id);
     }
     //更新抢购购买人数和数量
     if ($ifgroupbuy) {
         foreach ($store_cart_list as $goods_list) {
             foreach ($goods_list as $goods_info) {
                 if ($goods_info['ifgroupbuy'] && $goods_info['groupbuy_id']) {
                     $groupbuy_info = array();
                     $groupbuy_info['groupbuy_id'] = $goods_info['groupbuy_id'];
                     $groupbuy_info['quantity'] = $goods_info['goods_num'];
                     Uk86QueueClient::push('editGroupbuySaleCount', $groupbuy_info);
                 }
             }
         }
     }
     //删除购物车中的商品
     $this->delCart($ifcart, $this->_member_info['member_id'], array_keys($input_buy_items));
     @uk86_setNcCookie('cart_goods_num', '', -3600);
     //保存订单自提点信息
     if (C('delivery_isuse') && intval($input_address_info['dlyp_id'])) {
         $data = array();
         $data['mob_phone'] = $input_address_info['mob_phone'];
         $data['tel_phone'] = $input_address_info['tel_phone'];
         $data['reciver_name'] = $input_address_info['true_name'];
         $data['dlyp_id'] = $input_address_info['dlyp_id'];
         foreach ($order_list as $v) {
             $data['order_sn_list'][$v['order_id']]['order_sn'] = $v['order_sn'];
             $data['order_sn_list'][$v['order_id']]['add_time'] = $v['add_time'];
         }
         Uk86QueueClient::push('saveDeliveryOrder', $data);
     }
     //发送提醒类信息
     if (!empty($notice_list)) {
         foreach ($notice_list as $code => $value) {
             Uk86QueueClient::push('sendStoreMsg', array('code' => $code, 'store_id' => key($value), 'param' => current($value)));
         }
     }
 }
 /**
  * 浏览过的商品加入浏览历史数据库
  *
  * @param mixed $goods_id 商品ID或者商品ID数组
  * @return array
  */
 public function addViewedGoodsToCookie($goods_id)
 {
     if (!$goods_id) {
         return array('state' => false, 'msg' => '参数错误');
     }
     //浏览时间
     $browsetime = time();
     //构造cookie的一项值,每项cookie的值为商品ID-访问时间
     if (is_array($goods_id)) {
         $goods_idarr = $goods_id;
         foreach ($goods_id as $v) {
             $cookievalue[] = $v . '-' . $browsetime;
         }
     } else {
         $cookievalue[] = $goods_id . '-' . $browsetime;
         $goods_idarr[] = $goods_id;
     }
     unset($goods_id);
     if (uk86_cookie('viewed_goods')) {
         //如果cookie已经存在
         $string_viewed_goods = uk86_decrypt(uk86_cookie('viewed_goods'), MD5_KEY);
         if (get_magic_quotes_gpc()) {
             $string_viewed_goods = stripslashes($string_viewed_goods);
             // 去除斜杠
         }
         $vg_ca = @unserialize($string_viewed_goods);
         if (!empty($vg_ca) && is_array($vg_ca)) {
             foreach ($vg_ca as $vk => $vv) {
                 $vv_arr = explode('-', $vv);
                 if (in_array($vv_arr[0], $goods_idarr)) {
                     //如果该商品的浏览记录已经存在,则删除它
                     unset($vg_ca[$vk]);
                 }
             }
         } else {
             $vg_ca = array();
         }
         //将新浏览历史加入cookie末尾
         array_push($vg_ca, implode(',', $cookievalue));
         //cookie中最多存储50条浏览信息
         if (count($vg_ca) > 50) {
             $vg_ca = array_slice($vg_ca, -50, 50);
         }
     } else {
         $vg_ca = $cookievalue;
     }
     $vg_ca = uk86_encrypt(serialize($vg_ca), MD5_KEY);
     uk86_setNcCookie('viewed_goods', $vg_ca);
 }
Example #27
0
 /**
  * 退出操作
  *
  * @param int $id 记录ID
  * @return array $rs_row 返回数组形式的查询结果
  */
 public function logoutOp()
 {
     Uk86Language::uk86_read("home_login_index");
     $lang = Uk86Language::uk86_getLangContent();
     // 清理消息COOKIE
     uk86_setNcCookie('msgnewnum' . $_SESSION['member_id'], '', -3600);
     session_unset();
     session_destroy();
     uk86_setNcCookie('cart_goods_num', '', -3600);
     if (empty($_GET['ref_url'])) {
         $ref_url = uk86_getReferer();
     } else {
         $ref_url = $_GET['ref_url'];
     }
     uk86_redirect('index.php?act=login&ref_url=' . urlencode($ref_url));
 }
 public function select_cityOp()
 {
     $city_id = intval($_GET['city_id']);
     $model_live_area = Model('live_area');
     $city = $model_live_area->live_areaInfo(array('live_area_id' => $city_id));
     if (empty($city) && $city_id != 0) {
         uk86_showMessage('该城市不存在,请选择其他城市');
     }
     uk86_setNcCookie('city_id', $city_id);
     uk86_redirect("index.php?act=show_live_groupbuy");
 }