$smarty->assign('ur_here', $position['ur_here']); /* 是否显示积分兑换 */ if (!empty($_CFG['points_rule']) && unserialize($_CFG['points_rule'])) { $smarty->assign('show_transform_points', 1); } $smarty->assign('helps', get_shop_help()); // 网店帮助 $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']; }
/** * 调用购物车信息 * * @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_default() { // 获取全局变量 $_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'; 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'])); } } /* 代码增加2014-12-23 by www.68ecshop.com _star */ $min_time = gmtime() - 86400 * $_CFG['comment_youxiaoqi']; $num_comment = $db->getOne("SELECT COUNT(*) AS num FROM " . $ecs->table('order_goods') . " AS og\r\n\t\t\t\t\t\t\tLEFT JOIN " . $ecs->table('order_info') . " AS o ON og.order_id=o.order_id\r\n WHERE o.user_id = '{$user_id}' AND og.is_back = 0 AND og.comment_state = 0 AND o.shipping_time_end > {$min_time}"); $smarty->assign('num_comment', $num_comment); $smarty->assign('is_identity', $_CFG['identity']); /* 代码增加2014-12-23 by www.68ecshop.com _end */ /* 代码增加--cb--推荐分成-- by www.68ecshop.com _star */ $rn = $rank['rank_name']; $recomm = $db->getOne("SELECT is_recomm FROM " . $GLOBALS['ecs']->table('user_rank') . " WHERE rank_name= '{$rn}'"); $smarty->assign('recomm', $recomm); // 获取当前用户是否是分成用户判断是否显示我的推荐 /* 代码增加--cb--推荐分成-- by www.68ecshop.com _end */ $smarty->assign('info', get_user_default($user_id)); // 获取用户中心默认页面所需的数据 $smarty->assign('gouwuche', get_user_gouwuche($user_id)); // 获取当前用户购物车里面的数据 $smarty->assign('jifen', get_user_jifen()); // 获取当前积分商城里面的数据 $smarty->assign('collection', get_user_collection($user_id)); // 获取用户收藏的商品 $smarty->assign('guanzhu', get_user_guanzhu($user_id)); // 获取用户关注的店铺 $smarty->assign('mai', get_user_mai($user_id)); // 获取用户购买过的商品 $smarty->assign('reminding', get_user_reminding($user_id)); // 获取当前用户的交易记录 $smarty->assign('shu', get_user_shu($user_id)); // 获取当前用户的交易记录 // print_r(get_user_reminding($user_id)); $smarty->assign('user_notice', $_CFG['user_notice']); $smarty->assign('prompt', get_user_prompt($user_id)); // 获取用户参与活动信息 $smarty->display('user_clips.dwt'); }
function action_default() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $GLOBALS['user_id']; $order_count = $GLOBALS['db']->getOne("select count(*) from " . $GLOBALS['ecs']->table('order_info') . " where user_id = " . $user_id); $smarty->assign('order_count', $order_count); $collect_count = $GLOBALS['db']->getOne("select count(*) from " . $GLOBALS['ecs']->table('collect_goods') . " where user_id = " . $user_id); $smarty->assign('collect_count', $collect_count); $comment_count = $GLOBALS['db']->getOne("select count(*) from " . $GLOBALS['ecs']->table('comment') . " where user_id = " . $user_id); $smarty->assign('comment_count', $comment_count); include_once ROOT_PATH . 'includes/lib_clips.php'; if ($rank = get_rank_info()) { $smarty->assign('rank_name', sprintf($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'])); } } $sql = "select headimgurl from " . $GLOBALS['ecs']->table('weixin_user') . " where ecuid = '{$user_id}'"; $headimgurl = $GLOBALS['db']->getOne($sql); $smarty->assign('headimgurl', $headimgurl); $recomm = $db->getOne("SELECT is_recomm FROM " . $GLOBALS['ecs']->table('user_rank') . " r" . " LEFT JOIN" . $GLOBALS['ecs']->table('users') . " u ON r.rank_id = u.user_rank" . " WHERE u.user_id = '{$user_id}'"); $smarty->assign('recomm', $recomm); $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'); }
$result['error'] = '1'; $result['result'] = "所选属性库存不足"; } foreach ($goods_att as $val) { if (!empty($val)) { $sql = "SELECT `attr_price` FROM " . $ecs->table('goods_attr') . " WHERE goods_id='{$goods_id}' AND `goods_attr_id`='{$val}'"; $atr_price += $db->getOne($sql); } } $result['cart_price'] = $result['shop_price_shao'] + $atr_price; //本店售价加上属性价格 $result['is_promote'] = $goods['is_promote']; //$result['shop_price']=$goods_price+$atr_price; $result['promote_start_date'] = $goods['promote_start_date']; $result['promote_end_date'] = $goods['promote_end_date']; $result['user_rank_info'] = get_rank_info($user_id); //$result['user_rank_prices']=get_user_rank_prices($goods_id, $result['shop_price'],$user_id); $result['user_rank_prices'] = get_user_rank_prices($goods_id, $shop_pricr, $user_id, $atr_price, $goods['promote_price']); print_r(json_encode($result)); } /*=====================================ecshop的一些函数方法======================================*/ /** * 获得指定商品的各会员等级对应的价格 * * @access public * @param integer $goods_id * @return array */ function get_user_rank_prices($goods_id, $shop_price, $user_id, $atr_price, $promote_price) { $user_rank = $GLOBALS['db']->getOne("SELECT user_rank FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '{$user_id}'");
} $blank_permissions = array("Pages" => array("add_pages" => array("value" => 0, "disp_name" => "Add", "description" => "Enables members of this rank to add a new page to the website"), "edit_pages" => array("value" => 0, "disp_name" => "Edit", "description" => "Enables members of this rank to edit existing pages on the website, edit the staff, and edit the slider banner."), "delete_pages" => array("value" => 0, "disp_name" => "Delete", "description" => "Enables members of this rank to delete pages on the website")), "Blog" => array("post_blog" => array("value" => 0, "disp_name" => "Post", "description" => "Enables members of this rank to post a blog."), "edit_blog" => array("value" => 0, "disp_name" => "Edit", "description" => "Enables members of this rank to edit existing bl0ogs."), "delete_blog" => array("value" => 0, "disp_name" => "Delete", "description" => "Enables members of this rank to delete."), "post_comment" => array("value" => 0, "disp_name" => "Post Comments", "description" => "Enables members of this rank to post comments on a blog post."), "delete_any_comment" => array("value" => 0, "disp_name" => "Delete Any Comment", "description" => "Enables members of this rank to delete any comment on a blog post.")), "Forum" => array("add_delete_forum" => array("value" => 0, "disp_name" => "Add & Delete Forums", "description" => "Enables members of this rank to add and delete forums."), "edit_forum" => array("value" => 0, "disp_name" => "Edit Forum", "description" => "Enables members of this rank to edit a forum's name and description."), "add_thread" => array("value" => 0, "disp_name" => "Post Thread", "description" => "Enables members of this rank to post a thread in the forums."), "reply_to_thread" => array("value" => 0, "disp_name" => "Reply to Thread", "description" => "Enables members of this rank to reply to a thread in the forums."), "edit_thread" => array("value" => 0, "disp_name" => "Edit Post", "description" => "Enables members of this rank to edit their own post in the forums."), "pin_unpin_thread" => array("value" => 0, "disp_name" => "Pin & Unpin Thread", "description" => "Enables members of this rank to pin and unpin threads."), "lock_unlock_thread" => array("value" => 0, "disp_name" => "Lock & Unlock Thread", "description" => "Enables members of this rank to lock and unlock threads."), "delete_thread" => array("value" => 0, "disp_name" => "Delete Thread", "description" => "Enables members of this rank to delete threads from the forums.")), "Users" => array("add_users" => array("value" => 0, "disp_name" => "Add Users", "description" => "Enables members of this rank to add users to the website and change those users' ranks."), "delete_users" => array("value" => 0, "disp_name" => "Ban Users", "description" => "Enables members of this rank to ban users from the website."), "create_rank" => array("value" => 0, "disp_name" => "Create Ranks", "description" => "Enables members of this rank to create ranks on the website."), "edit_rank" => array("value" => 0, "disp_name" => "Edit Ranks", "description" => "Enables members of this rank to edit existing ranks on the website."), "delete_rank" => array("value" => 0, "disp_name" => "Delete Ranks", "description" => "Enables members of this rank to delete ranks on the website.")), "Uploading" => array("upload_files" => array("value" => 0, "disp_name" => "Upload Files", "description" => "Enables members of this rank to upload files to the website."), "delete_files" => array("value" => 0, "disp_name" => "Delete Files", "description" => "Enables members of this rank to delete files from the website."), "rename_files" => array("value" => 0, "disp_name" => "Rename Files", "description" => "Enables members of this rank to rename uploaded files on the website."), "create_files" => array("value" => 0, "disp_name" => "Create Files", "description" => "Enables members of this rank to create new files on the website."), "edit_files" => array("value" => 0, "disp_name" => "Edit Files", "description" => "Enables members of this rank to edit files on the website."), "create_folders" => array("value" => 0, "disp_name" => "Create Folders", "description" => "Enables members of this rank to create folers to put files in."), "rename_folders" => array("value" => 0, "disp_name" => "Rename Folders", "description" => "Enables members of this rank to rename folders."), "delete_folders" => array("value" => 0, "disp_name" => "Delete Folders", "description" => "Enables members of this rank to delete folders.")), "Galleries" => array("add_gallery" => array("value" => 0, "disp_name" => "Add Galleries", "description" => "Enables members of this rank to add galleries to the website."), "edit_gallery" => array("value" => 0, "disp_name" => "Edit Galleries", "description" => "Enables members of this rank to edit existing galleries."), "delete_gallery" => array("value" => 0, "disp_name" => "Delete Galleries", "description" => "Enables members of this rank to delete galleries from the website."), "rename_gallery" => array("value" => 0, "disp_name" => "Rename Galleries", "description" => "Enables members of this rank to rename galleries.")), "Sliders" => array("add_slider" => array("value" => 0, "disp_name" => "Add Slider", "description" => "Enables members of this rank to add sliders to the website."), "edit_slider" => array("value" => 0, "disp_name" => "Edit Slider", "description" => "Enables members of this rank to edit existing sliders."), "delete_slider" => array("value" => 0, "disp_name" => "Delete Slider", "description" => "Enables members of this rank to delete sliders from the website."), "rename_slider" => array("value" => 0, "disp_name" => "Rename Slider", "description" => "Enables members of this rank to rename sliders.")), "Forms" => array("add_form" => array("value" => 0, "disp_name" => "Add Forms", "description" => "Enables members of this rank to add forms."), "edit_form" => array("value" => 0, "disp_name" => "Edit Forms", "description" => "Enables members of this rank to edit existing forms."), "delete_form" => array("value" => 0, "disp_name" => "Delete Forms", "description" => "Enables members of this rank to delete forms.")), "Website" => array("cpanel_access" => array("value" => 0, "disp_name" => "CPanel Access", "description" => "Enables members of this rank to access the admin CPanel."), "edit_site_settings" => array("value" => 0, "disp_name" => "Edit Website Information", "description" => "Enables members of this rank to edit the website information."), "edit_site_colors" => array("value" => 0, "disp_name" => "Edit Website Colors", "description" => "Enables members of this rank to modify the website theme colors."), "upload_favicon_banner" => array("value" => 0, "disp_name" => "Upload Favicon and Banner", "description" => "Enables members of this rank to upload a favicon and banner to the website."), "edit_socnet" => array("value" => 0, "disp_name" => "Edit Social Networks", "description" => "Enables members of this rank to edit the social networks the website is connected to."), "edit_google_analytics" => array("value" => 0, "disp_name" => "Edit Google Analytics", "description" => "Enables members of this rank to edit the Google Analytics information."))); //Adds all new permissions to admin ranks $query = "SELECT * FROM `ranks` WHERE `admin_rank` = 1"; $result = mysqli_query($connection, $query); while ($admin_rank = mysqli_fetch_array($result)) { $admin_permissions = unserialize($admin_rank['permissions']); $enabled_perms = enable_all_perms($blank_permissions); if ($admin_permissions != $enabled_perms) { $admin_permissions = mysqli_real_escape_string($connection, serialize($enabled_perms)); $query = "UPDATE `ranks` SET\n\t\t\t`permissions` = '{$admin_permissions}' WHERE `id` = {$admin_rank['id']}"; mysqli_query($connection, $query); } } if (logged_in()) { $permissions = array_replace_recursive($blank_permissions, get_rank_info()); } else { $permissions = ""; } if (isset($_SESSION['user_id'])) { $query = "SELECT * FROM `users` WHERE `id` = {$_SESSION['user_id']}"; $result = mysqli_query($connection, $query); $user_info = mysqli_fetch_array($result); } function check_permission($perm_group, $perm = false) { global $connection; global $permissions; if (logged_in()) { if (is_array($perm_group) && $perm == false) { $return = false;
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']); // 用户名 }
<?php /** * 购物车更新商品价格 */ define('IN_ECS', true); require '../includes/init.php'; //require('../includes/lib_goods.php'); $goods_id_arr = isset($_REQUEST['goods_id_arr']) ? trim($_REQUEST['goods_id_arr']) : 0; $user_id = isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0; $sql = "SELECT g.goods_id,g.shop_price,g.is_promote,g.promote_price,g.promote_start_date,g.promote_end_date FROM " . $GLOBALS['ecs']->table('goods') . " AS g WHERE is_delete = '0' AND is_on_sale = '1' and g.goods_number >0 AND g.goods_id IN ({$goods_id_arr})"; $row = $GLOBALS['db']->getAll($sql); $user_rank_name = get_rank_info($user_id); $time = time(); foreach ($row as $k => $value) { $user_rank_prices = get_user_rank_prices($value['goods_id'], $value['shop_price'], $user_id); foreach ($user_rank_prices as $rank_prices_value) { if ($user_rank_name['rank_name'] == $rank_prices_value['rank_name']) { if ($value['is_promote'] == 1) { //if($value['promote_price']<$rank_prices_value['price']&&$value['promote_start_date']<=$time&&$value['promote_end_date']>$time){ //$row[$k]['shop_price']=str_replace('¥','',$value['promote_price']); //}else{ $row[$k]['shop_price'] = str_replace('¥', '', $rank_prices_value['price']); //} } else { $row[$k]['shop_price'] = str_replace('¥', '', $rank_prices_value['price']); } } } } print_r(json_encode($row));