// 网店帮助 $smarty->assign('data_dir', DATA_DIR); // 数据目录 $smarty->assign('action', $action); $smarty->assign('lang', $_LANG); } //用户中心欢迎页 if ($action == 'default') { include_once ROOT_PATH . 'includes/lib_clips.php'; if ($rank = get_rank_info()) { $smarty->assign('rank_name', sprintf($_LANG['your_level'], $rank['rank_name'])); if (!empty($rank['next_rank_name'])) { $smarty->assign('next_rank_name', sprintf($_LANG['next_level'], $rank['next_rank'], $rank['next_rank_name'])); } } $smarty->assign('info', get_user_default($user_id)); $smarty->assign('user_notice', $_CFG['user_notice']); $smarty->assign('prompt', get_user_prompt($user_id)); $smarty->display('user_clips.dwt'); } /* 显示会员注册界面 */ if ($action == 'register') { if (!isset($back_act) && isset($GLOBALS['_SERVER']['HTTP_REFERER'])) { $back_act = strpos($GLOBALS['_SERVER']['HTTP_REFERER'], 'user.php') ? './index.php' : $GLOBALS['_SERVER']['HTTP_REFERER']; } /* 验证码相关设置 */ if (intval($_CFG['captcha']) & CAPTCHA_REGISTER && gd_version() > 0) { $smarty->assign('enabled_captcha', 1); $smarty->assign('rand', mt_rand()); } /* 增加是否关闭注册 */
/** * 调用购物车信息 * * @access public * @return string */ function insert_cart_info() { $sql = 'SELECT SUM(goods_number) AS number, SUM(goods_price * goods_number) AS amount' . ' FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'"; $row = $GLOBALS['db']->GetRow($sql); if ($row) { $number = intval($row['number']); $amount = floatval($row['amount']); } else { $number = 0; $amount = 0; } $str = sprintf($GLOBALS['_LANG']['cart_info'], $number, price_format($amount, false)); return '<a rel="nofllow" href="flow.php">购 物 车(<font color="#FF0000"><span id="ECS_CARTINFO">' . $number . '</span></font>)</a>'; //return '购物车('.$number.')'; //return '<a href="flow.php" title="' . $GLOBALS['_LANG']['view_cart'] . '">' . $str . '</a>'; /*取出用户的一些基本信息 bli add 2009-9-13*/ require 'includes\\lib_clips.php'; $user_id = $_SESSION['user_id']; $info = get_user_default($user_id); if ($user_id != 0) { $rank_array = get_rank_info(); $rank = $rank_array['rank_name']; $username = $info['username']; $surplus = $info['surplus']; //余额 $integral = $info['integral']; //积分 //echo "<pre>";print_r($rank_array);echo "</pre>".$rank; $str = "选购商品总计:" . $number . "件<br>总金额:" . price_format($amount, false); return '<a href="flow.php" title="' . $GLOBALS['_LANG']['view_cart'] . '">' . $str . '</a><br>'; } else { $rank = "未注册用户"; //等级 $username = ""; $surplus = 0; //余额 $integral = 0; //积分 $str = "选购商品总计:" . $number . "件 总金额:" . price_format($amount, false); return "欢迎光临衣天下 " . '<a href="flow.php" title="' . $GLOBALS['_LANG']['view_cart'] . '">' . $str . "</a>"; } /*取出用户的一些基本信息 bli end 2009-9-13*/ }
function action_vc_login() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; include_once ROOT_PATH . 'includes/lib_clips.php'; $smarty->assign('info', get_user_default($user_id)); $smarty->display('user_transaction.dwt'); }
/** * 用户中心显示 */ function show_user_center() { include_once ROOT_PATH . 'includes/lib_clips.php'; $best_goods = get_recommend_goods('best'); if (count($best_goods) > 0) { foreach ($best_goods as $key => $best_data) { $best_goods[$key]['shop_price'] = encode_output($best_data['shop_price']); $best_goods[$key]['name'] = encode_output($best_data['name']); } } //22:18 2013-7-16 $rank_name = $GLOBALS['db']->getOne('SELECT rank_name FROM ' . $GLOBALS['ecs']->table('user_rank') . ' WHERE rank_id = ' . $_SESSION['user_rank']); $GLOBALS['smarty']->assign('info', get_user_default($_SESSION['user_id'])); $GLOBALS['smarty']->assign('rank_name', $rank_name); $GLOBALS['smarty']->assign('user_info', get_user_info()); $GLOBALS['smarty']->assign('best_goods', $best_goods); $GLOBALS['smarty']->assign('footer', get_footer()); $GLOBALS['smarty']->display('user.dwt'); }
// 网店帮助 $smarty->assign('data_dir', DATA_DIR); // 数据目录 $smarty->assign('action', $action); $smarty->assign('lang', $_LANG); } //用户中心欢迎页 if ($action == 'default') { include_once ROOT_PATH . 'include/lib_clips.php'; if ($rank = get_rank_info()) { $smarty->assign('rank_name', sprintf($_LANG['your_level'], $rank['rank_name'])); if (!empty($rank['next_rank_name'])) { $smarty->assign('next_rank_name', sprintf($_LANG['next_level'], $rank['next_rank'], $rank['next_rank_name'])); } } $info = get_user_default($user_id); $sql = "SELECT wxid FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '{$user_id}'"; $wxid = $GLOBALS['db']->getOne($sql); if (!empty($wxid)) { $weixinInfo = $GLOBALS['db']->getRow("SELECT nickname, headimgurl FROM wxch_user WHERE wxid = '{$wxid}'"); $info['avatar'] = empty($weixinInfo['headimgurl']) ? '' : $weixinInfo['headimgurl']; $info['username'] = empty($weixinInfo['nickname']) ? $info['username'] : $weixinInfo['nickname']; } /*甜心100分销微分销新增显示分销会员标准*/ $affiliate = unserialize($GLOBALS['_CFG']['affiliate']); $level_register_up = (double) $affiliate['config']['level_register_up']; $rank_points = $GLOBALS['db']->getOne("SELECT rank_points FROM " . $GLOBALS['ecs']->table('users') . "where user_id=" . $_SESSION["user_id"]); if ($rank_points > $level_register_up || $rank_points == $level_register_up) { $tianxin = "资格:分销商"; } else { show_message('您还不是分销商哦', '请先购买商品获取权限', 'user.php', 'error');
$time = gmtime(); $sql = "INSERT INTO " . $GLOBALS['ecs']->table('collect_goods') . " (user_id, goods_id, add_time)" . "VALUES ('{$_SESSION['user_id']}', '{$goods_id}', '{$time}')"; if ($GLOBALS['db']->query($sql) === false) { $result['error'] = 1; $result['message'] = $GLOBALS['db']->errorMsg(); die($json->encode($result)); } else { $result['error'] = 0; $result['message'] = "该商品已经成功地加入了您的收藏夹。"; die($json->encode($result)); } } } } elseif ($act == 'collection_list') { include_once ROOT_PATH . 'includes/lib_clips.php'; $GLOBALS['smarty']->assign('info', get_user_default($_SESSION['user_id'])); //888 if ($rank = get_rank_info()) { $GLOBALS['smarty']->assign('rank_name', $rank['rank_name']); } $smarty->assign('goods_data', get_collection_goods($_SESSION['user_id'], 20, 0)); $smarty->display('favorites.html'); } elseif ($act == 'del_attention') { $rec_id = (int) $_GET['rec_id']; if ($rec_id) { $db->query('DELETE FROM ' . $ecs->table('collect_goods') . " WHERE rec_id='{$rec_id}' AND user_id ='{$user_id}'"); } ecs_header("Location: user.php?act=collection_list\n"); exit; } elseif ($act == 'profile') { include_once ROOT_PATH . 'includes/lib_transaction.php';
function user_infomation($smarty, $user_id = '') { //var_dump($_SESSION); include_once ROOT_PATH . 'includes/lib_clips.php'; $rank = get_rank_info(); $vip_name = $rank['rank_name']; $sql = "select personal_pic from " . $GLOBALS['ecs']->table('users') . " where user_id={$user_id}"; $personal_pic = $GLOBALS['db']->getOne($sql); $smarty->assign('personal_pic', $personal_pic); $smarty->assign('info', get_user_default($user_id)); //用户信息 $progress_bar = ''; $vip_pic = ''; switch ($vip_name) { case 'VIP0': $progress_bar = 'a'; $vip_pic = 'vip_s0.png'; break; case 'VIP1': $progress_bar = 'b'; $vip_pic = 'vip_s1.png'; break; case 'VIP2': $progress_bar = 'c'; $vip_pic = 'vip_s2.png'; break; case 'VIP3': $progress_bar = 'd'; $vip_pic = 'vip_s3.png'; break; case 'VIP4': $progress_bar = 'e'; $vip_pic = 'vip_s4.png'; break; default: $progress_bar = 'e'; $vip_pic = 'vip_s0.png'; break; } //$vip_name = str_replace('VIP','VIP.',$vip_name); $smarty->assign('vip_pic', $vip_pic); $smarty->assign('vip_name', $vip_name); // 用户名 $smarty->assign('progress_bar', $progress_bar); // 用户名 }
function user_infomation($smarty, $user_id = '') { include_once ROOT_PATH . 'includes/lib_clips.php'; $rank = get_rank_info(); $smarty->assign('info', get_user_default($user_id)); //用户信息 $smarty->assign('vip_name', $rank['rank_name']); // 用户名 $vip_pic = ''; switch ($rank['rank_name']) { case 'VIP0': $vip_pic = 'vip_s0.png'; break; case 'VIP1': $vip_pic = 'vip_s1.png'; break; case 'VIP2': $vip_pic = 'vip_s2.png'; break; case 'VIP3': $vip_pic = 'vip_s3.png'; break; case 'VIP4': $vip_pic = 'vip_s4.png'; break; default: $vip_pic = 'vip_s0.png'; break; } $smarty->assign('vip_pic', $vip_pic); }
function user_infomation($smarty, $user_id = '') { include_once ROOT_PATH . 'includes/lib_clips.php'; $rank = get_rank_info(); // var_dump(get_user_default($user_id)); $user_rank_list = get_user_rank_list(); //var_dump($user_rank_list); $info = get_user_default($user_id); foreach ($user_rank_list as $tKey => $tVal) { if ($tVal['max_points'] > $info['rank_points'] && $tVal['min_points'] <= $info['rank_points']) { $info['current_lever'] = $tVal['rank_name']; $info['next_lever'] = $user_rank_list[$tKey + 1]['rank_name']; $info['overFlowPoints'] = $info['rank_points'] - $tVal['min_points']; $info['baseLeverPoints'] = $tVal['max_points'] - $tVal['min_points']; $info['leverRate'] = 100.0 * $info['overFlowPoints'] / $info['baseLeverPoints']; } else { if ($tVal['max_points'] < $info['rank_points']) { $info['current_lever'] = $tVal['rank_name']; $info['next_lever'] = $tVal['rank_name']; $info['leverRate'] = 100.0; } } } $smarty->assign('info', $info); //用户信息 $smarty->assign('vip_name', $rank['rank_name']); // 用户名 }
$nglist[$g['id']][] = $n; } } } } $taocan['num'] = count($glist); $smarty->assign('nglist', $nglist); $smarty->assign('taocan', $taocan); $smarty->display('taocan_buy.dwt'); } if ($act == 'done') { include_once ROOT_PATH . 'includes/lib_clips.php'; $_LANG['user_bonus_info'] = '共计 %d 个,价值 %s'; $id = $_REQUEST['id']; $taocan = $db->getRow("select * from " . $ecs->table("system_taocan") . " where id=" . $id); $user = get_user_default($_SESSION['user_id']); if (empty($user['to_date1']) || $user['to_date1'] < gmtime()) { //判断合同期限 $taocan['beizhu'] = '用户合同期限到期'; } elseif ($user['user_money'] < $taocan['tprice']) { $taocan['beizhu'] = '用户余额不足'; } else { $taocan['beizhu'] = ''; } if (!empty($taocan['beizhu'])) { $taocan['status'] = 2; } else { $taocan['status'] = 1; } $db->query("INSERT INTO " . $ecs->table("user_taocan") . " (tname,tprice,tpic,last_date,descs,status,user_id,beizhu)\n values('" . $taocan['tname'] . "','" . $taocan['tprice'] . "','" . $taocan['tpic'] . "','" . gmtime() . "','" . $taocan['descs'] . "',\n '" . $taocan['status'] . "','" . $_SESSION['user_id'] . "','" . $taocan['beizhu'] . "') "); $nid = $db->insert_id();