Ejemplo n.º 1
0
 //        {
 //            sys_msg($_LANG['disable_ok'], 0, $link);
 //        }
 //        else
 //        {
 //            sys_msg($_LANG['disable_error'], 1, $link);
 //        }
 //
 //        break;
 /* 显示短信发送界面,如果尚未注册或启用短信服务则显示注册界面。 */
 case 'display_send_ui':
     /* 检查权限 */
     admin_priv('sms_send');
     if ($sms->has_registered()) {
         $smarty->assign('ur_here', $_LANG['03_sms_send']);
         $special_ranks = get_rank_list();
         $send_rank['1_0'] = $_LANG['user_list'];
         foreach ($special_ranks as $rank_key => $rank_value) {
             $send_rank['2_' . $rank_key] = $rank_value;
         }
         assign_query_info();
         $smarty->assign('send_rank', $send_rank);
         $smarty->display('sms_send_ui.htm');
     } else {
         $smarty->assign('ur_here', $_LANG['register_sms']);
         $smarty->assign('sms_site_info', $sms->get_site_info());
         assign_query_info();
         $smarty->display('sms_register_ui.htm');
     }
     break;
     /* 发送短信 */
Ejemplo n.º 2
0
        }
    }
    $smarty->assign('lang', $_LANG);
    $smarty->assign('country_list', get_regions());
    $province_list = get_regions(1, $row['country']);
    $city_list = get_regions(2, $row['province']);
    $district_list = get_regions(3, $row['city']);
    $smarty->assign('province_list', $province_list);
    $smarty->assign('city_list', $city_list);
    $smarty->assign('district_list', $district_list);
    assign_query_info();
    $smarty->assign('ur_here', $_LANG['users_edit']);
    $smarty->assign('action_link', array('text' => $_LANG['01_users_list'], 'href' => 'distributor.php?act=list&' . list_link_postfix()));
    $smarty->assign('user', $user);
    $smarty->assign('form_action', 'update');
    $smarty->assign('special_ranks', get_rank_list(true));
    $smarty->display('distributor_info.htm');
} elseif ($_REQUEST['act'] == 'update') {
    /* 检查权限 */
    admin_priv('users_manage');
    $username = empty($_POST['username']) ? '' : trim($_POST['username']);
    $password = empty($_POST['password']) ? '' : trim($_POST['password']);
    $email = empty($_POST['email']) ? '' : trim($_POST['email']);
    $sex = empty($_POST['sex']) ? 0 : intval($_POST['sex']);
    $sex = in_array($sex, array(0, 1, 2)) ? $sex : 0;
    $birthday = $_POST['birthdayYear'] . '-' . $_POST['birthdayMonth'] . '-' . $_POST['birthdayDay'];
    $rank = empty($_POST['user_rank']) ? 0 : intval($_POST['user_rank']);
    $credit_line = empty($_POST['credit_line']) ? 0 : floatval($_POST['credit_line']);
    $real_name = empty($_POST['real_name']) ? '' : trim($_POST['real_name']);
    $card = empty($_POST['card']) ? '' : trim($_POST['card']);
    $country = $_POST['country'];
Ejemplo n.º 3
0
/**
 *  返回用户列表数据
 *
 * @access  public
 * @param
 *
 * @return void
 */
function user_list()
{
    $result = get_filter();
    $filter = array();
    if ($result === false) {
        /* 过滤条件 */
        $filter['user_name'] = empty($_REQUEST['user_name']) ? '' : trim(urldecode($_REQUEST['user_name']));
        $filter['admin_id'] = empty($_REQUEST['admin_id']) ? 0 : intval($_REQUEST['admin_id']);
        $filter['address'] = empty($_REQUEST['address']) ? '' : trim($_REQUEST['address']);
        $filter['zipcode'] = empty($_REQUEST['zipcode']) ? '' : trim($_REQUEST['zipcode']);
        $filter['home_phone'] = empty($_REQUEST['tel']) ? '' : trim($_REQUEST['tel']);
        $filter['mobile_phone'] = empty($_REQUEST['mobile']) ? 0 : intval($_REQUEST['mobile']);
        $filter['country'] = empty($_REQUEST['country']) ? 0 : intval($_REQUEST['country']);
        $filter['province'] = empty($_REQUEST['province']) ? 0 : intval($_REQUEST['province']);
        $filter['city'] = empty($_REQUEST['city']) ? 0 : intval($_REQUEST['city']);
        $filter['district'] = empty($_REQUEST['district']) ? 0 : intval($_REQUEST['district']);
        $filter['platform'] = empty($_REQUEST['platform']) ? 0 : intval($_REQUEST['platform']);
        $filter['from_where'] = !intval($_REQUEST['from_where']) ? 0 : intval($_REQUEST['from_where']);
        $filter['eff_id'] = empty($_REQUEST['eff_id']) ? 0 : intval($_REQUEST['eff_id']);
        $filter['start_time'] = empty($_REQUEST['start_time']) ? 0 : $_REQUEST['start_time'];
        $filter['end_time'] = empty($_REQUEST['end_time']) ? 0 : $_REQUEST['end_time'];
        $filter['time_select'] = empty($_REQUEST['time_select']) ? 3 : $_REQUEST['time_select'];
        $filter['purchase'] = empty($_REQUEST['purchase']) ? 0 : trim($_REQUEST['purchase']);
        $filter['district'] = empty($_REQUEST['district']) ? 0 : intval($_REQUEST['district']);
        $filter['city'] = empty($_REQUEST['city']) ? 0 : $_REQUEST['city'];
        $filter['province'] = empty($_REQUEST['province']) ? 0 : $_REQUEST['province'];
        $filter['address'] = empty($_REQUEST['address']) ? 0 : trim($_REQUEST['address']);
        $filter['sel_opt'] = !isset($_REQUEST['sel_opt']) ? 0 : intval($_REQUEST['sel_opt']);
        $filter['contact_opt'] = empty($_REQUEST['contact_opt']) ? 0 : intval($_REQUEST['contact_opt']);
        $filter['level'] = empty($_REQUEST['level']) ? 0 : intval($_REQUEST['level']);
        $filter['number_purchased'] = empty($_REQUEST['number_purchased']) ? 0 : intval($_REQUEST['number_purchased']);
        $filter['start_time'] = strtotime(stamp2date($_REQUEST['start_time'], 'Y-m-d H:i:s'));
        $filter['end_time'] = strtotime(stamp2date($_REQUEST['end_time'], 'Y-m-d H:i:s'));
        //李健均的有无服务顾客分类
        if (isset($_REQUEST['type'])) {
            $customer_type = urldecode($_REQUEST['type']);
            if (!in_array($customer_type, array(77, 66))) {
                $filter['type'] = empty($_REQUEST['type']) ? 0 : $customer_type;
            } else {
                $filter['type'] = 2;
                $service_where = $customer_type == 66 ? ' AND service_time IS NOT NULL ' : ' AND service_time IS NULL ';
            }
        }
        $filter['cat_tag'] = empty($_REQUEST['cat_tag']) ? 0 : intval($_REQUEST['cat_tag']);
        if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) {
            $filter['keywords'] = json_str_iconv($filter['keywords']);
        }
        $ex_where = ' WHERE u.admin_id<>647 ';
        // 顾客搜索
        if (!empty($_REQUEST['keywords']) && isset($_REQUEST['keywords'])) {
            $filter['keyfields'] = mysql_real_escape_string(trim($_REQUEST['keyfields']));
            $filter['keywords'] = mysql_real_escape_string(trim(urldecode($_REQUEST['keywords'])));
            $ex_where .= " AND {$filter['keyfields']} LIKE '%{$filter['keywords']}%' ";
        }
        foreach ($filter as $key => $val) {
            if (!empty($val)) {
                if ($key == 'type') {
                    $condition .= "&{$key}=" . urlencode($val);
                    continue;
                }
                $condition .= "&{$key}={$val}";
            }
        }
        if ($filter['platform']) {
            $ex_where .= " AND platform='{$filter['platform']}' ";
        }
        if ($filter['purchase']) {
            $ex_where .= " AND purchase='{$filter['purchase']}' ";
        }
        if ($filter['number_purchased']) {
            $ex_where .= " AND number_purchased>={$filter['number_purchased']} ";
        }
        //有无微信
        if ($filter['sel_opt'] && $filter['contact_opt']) {
            switch ($filter['contact_opt']) {
                case 1:
                    $contact_field = 'u.qq';
                    break;
                case 2:
                    $contact_field = 'u.wechat';
                    break;
                case 3:
                    $contact_field = 'u.aliww';
                    break;
            }
            //$contact_field = $filter['contact_opt'] == 1 ? 'u.qq' : 'u.wechat';
            $operator = $filter['sel_opt'] == 1 ? '=' : '<>';
            $ex_where .= " AND {$contact_field}{$operator}'' ";
        }
        /* 按顾客来源显示 顾客列表 */
        if ($filter['from_where']) {
            $ex_where .= " AND u.from_where='{$filter['from_where']}' ";
        }
        /* 按功效 */
        if ($filter['eff_id']) {
            $ex_where .= " AND u.eff_id='{$filter['eff_id']}' ";
        }
        // 顾客姓名
        if ($filter['user_name']) {
            $ex_where .= " AND u.user_name LIKE '%{$filter['user_name']}%' ";
        }
        if ($filter['level']) {
            $ex_where .= " AND level='{$filter['level']}' ";
        }
        $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('users') . ' u ';
        // 客服
        if (admin_priv('all', '', false)) {
            //限制最高权限
            $rb = return_role_by_all();
            if ($rb) {
                $ex_where .= " AND u.role_id IN({$rb})";
            }
            $ex_where .= ' AND u.admin_id>0';
            $filter['admin_id'] > 0 && ($ex_where .= " AND u.admin_id={$filter['admin_id']} ");
        } elseif (admin_priv('user_trans-part_view', '', false) || admin_priv('user_part_view', '', false)) {
            if ($filter['admin_id']) {
                $ex_where .= " AND u.admin_id={$filter['admin_id']} ";
            } elseif (in_array($filter['keyfields'], array('user_name', 'home_phone', 'mobile_phone')) && !empty($filter['keywords'])) {
                $ex_where .= " AND u.role_id={$_SESSION['role_id']} ";
            } else {
                $ex_where .= " AND u.admin_id={$_SESSION['admin_id']} ";
            }
            //if (admin_priv('user_trans-part_view', '', false) || admin_priv('user_part_view', '', false)) {
            //    $trans_role_list = implode(',', trans_part_list());
            //$sql_select_admin = 'SELECT user_id FROM '.$GLOBALS['ecs']->table('admin_user').
            //    " WHERE user_id={$filter['admin_id']} AND role_id IN ($trans_role_list)";
            //$power = $GLOBALS['db']->getOne($sql_select_admin);
            //} elseif (admin_priv('user_part_view', '', false)) {
            //$sql_select_admin = 'SELECT user_id FROM '.$GLOBALS['ecs']->table('admin_user').
            //    " WHERE user_id={$filter['admin_id']} AND role_id={$_SESSION['role_id']}";
            //$power = $GLOBALS['db']->getOne($sql_select_admin);
            //}
        } elseif (admin_priv('user_group_view', '', false)) {
            //$ex_where .= " AND u.role_id={$_SESSION['role_id']}";
            if ($filter['admin_id']) {
                $ex_where .= " AND u.admin_id={$filter['admin_id']} ";
            } elseif ($filter['keywords']) {
                $ex_where .= " AND u.role_id={$_SESSION['role_id']}";
            } else {
                $ex_where .= " AND u.admin_id={$_SESSION['admin_id']}";
            }
        } else {
            $ex_where .= " AND u.admin_id={$_SESSION['admin_id']} ";
        }
        $ex_where .= " AND customer_type NOT IN(4,5,6)";
        // 区
        if ($filter['district']) {
            $sql .= ', ' . $GLOBALS['ecs']->table('region') . ' r, ' . $GLOBALS['ecs']->table('user_address') . ' a ';
            $ex_where .= " AND u.user_id=a.user_id AND a.district=r.region_id AND a.district={$filter['district']}";
        } elseif ($filter['city']) {
            $sql .= ', ' . $GLOBALS['ecs']->table('region') . ' r, ' . $GLOBALS['ecs']->table('user_address') . ' a ';
            $ex_where .= " AND u.user_id=a.user_id AND a.city=r.region_id AND a.city={$filter['city']}";
        } elseif ($filter['province']) {
            $sql .= ', ' . $GLOBALS['ecs']->table('region') . ' r, ' . $GLOBALS['ecs']->table('user_address') . ' a ';
            $ex_where .= " AND u.user_id=a.user_id AND a.province=r.region_id AND a.province={$filter['province']}";
        }
        // 详细地址
        if ($filter['saddress']) {
            $sql .= ', ' . $GLOBALS['ecs']->table('user_address') . ' a ';
            $ex_where .= " AND a.address LIKE '%{$filter['saddress']}%' AND a.user_id=u.user_id";
        }
        // 自定义分类
        $admin_id = $filter['admin_id'] == 0 ? $_SESSION['admin_id'] : $filter['admin_id'];
        if ($filter['cat_tag']) {
            $ex_where .= " AND user_cat='{$admin_id}-{$filter['cat_tag']}' ";
        } elseif ($_REQUEST['act'] == 'user_cat_list') {
            $ex_where .= " AND user_cat NOT LIKE '{$admin_id}-%' ";
        }
        if ($filter['start_time'] && $filter['end_time']) {
            if ($filter['start_time'] > $filter['end_time']) {
                $time_tmp = $filter['end_time'];
                $filter['end_time'] = $filter['start_time'];
                $filter['start_time'] = $time_tmp;
            }
            $filter['start_time'] = strtotime(date('Y-m-d 00:00:00', $filter['start_time']));
            $filter['end_time'] = strtotime(date('Y-m-d 23:59:59', $filter['end_time']));
            switch ($filter['time_select']) {
                case 1:
                    $time_where = 'service_time';
                    break;
                case 2:
                    $time_where = 'order_time';
                    break;
                case 3:
                    $time_where = 'add_time';
                    break;
                case 4:
                    $time_where = 'assign_time';
                    break;
            }
            $ex_where .= " AND u.{$time_where} BETWEEN '{$filter['start_time']}' AND '{$filter['end_time']}'";
        }
        if ($filter['type']) {
            $ex_where .= " AND u.customer_type IN ({$filter['type']}) ";
        }
        // 功效分类
        if ($filter['eff_id'] && $filter['eff_id'] > 0) {
            $ex_where .= " AND u.eff_id={$filter['eff_id']}";
        } elseif ($filter['eff_id'] && $filter['eff_id'] < 0) {
            $ex_where .= ' AND u.eff_id=0 ';
        }
        $sql .= $ex_where . $service_where;
        $filter['record_count'] = $GLOBALS['db']->getOne($sql);
        /* 分页大小 */
        $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
        if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) {
            $filter['page_size'] = intval($_REQUEST['page_size']);
        } else {
            $filter['page_size'] = 20;
        }
        $filter['page_count'] = $filter['record_count'] > 0 ? ceil($filter['record_count'] / $filter['page_size']) : 1;
        // 设置分页
        $page_set = array(1, 2, 3, 4, 5, 6, 7);
        if ($filter['page'] > 4) {
            foreach ($page_set as &$val) {
                $val += $filter['page'] - 4;
            }
        }
        if (end($page_set) > $filter['page_count']) {
            $page_set = array();
            for ($i = 7; $i >= 0; $i--) {
                if ($filter['page_count'] - $i > 0) {
                    $page_set[] = $filter['page_count'] - $i;
                }
            }
        }
        //$sql = 'SELECT u.age_group,u.admin_name,u.user_id,u.is_black,e.eff_name,c.bind_time,u.user_name,u.sex,'.
        //    'u.is_validated,u.add_time,u.remarks,u.service_time,u.assign_time FROM '
        //    .$GLOBALS['ecs']->table('users').' u LEFT JOIN '.
        //    $GLOBALS['ecs']->table('memship_number').' c ON c.user_id=u.user_id LEFT JOIN '.$GLOBALS['ecs']->table('effects').
        //    ' e ON e.eff_id=u.eff_id';
        $sql = 'SELECT u.age_group,u.admin_name,u.user_id,u.is_black,u.user_name,u.sex,u.user_rank,' . 'u.is_validated,u.add_time,u.remarks,u.service_time,u.assign_time FROM ' . $GLOBALS['ecs']->table('users') . ' u ';
        //判断一个月内转移的顾客
        $_REQUEST['transfer_time'] && ($filter['transfer_time'] = $_REQUEST['transfer_time']);
        if ($filter['transfer_time']) {
            $ex_where .= ' AND u.transfer_time>' . $filter['transfer_time'];
        }
        if ($filter['district']) {
            $sql .= ', ' . $GLOBALS['ecs']->table('region') . ' r, ' . $GLOBALS['ecs']->table('user_address') . ' a ';
            $ex_where .= " AND u.user_id=a.user_id AND a.district=r.region_id AND a.district={$filter['district']}";
        } elseif ($filter['city']) {
            $sql .= ', ' . $GLOBALS['ecs']->table('region') . ' r, ' . $GLOBALS['ecs']->table('user_address') . ' a ';
            $ex_where .= " AND u.user_id=a.user_id AND a.city=r.region_id AND a.city={$filter['city']}";
        } elseif ($filter['province']) {
            $sql .= ', ' . $GLOBALS['ecs']->table('region') . ' r, ' . $GLOBALS['ecs']->table('user_address') . ' a ';
            $ex_where .= " AND u.user_id=a.user_id AND a.province=r.region_id AND a.province={$filter['province']}";
        }
        $ex_where .= $service_where . ' ORDER by service_time ASC LIMIT ' . ($filter['page'] - 1) * $filter['page_size'] . ', ' . $filter['page_size'];
        $sql .= $ex_where;
        $filter['keywords'] = stripslashes($filter['keywords']);
        set_filter($filter, $sql);
    } else {
        $sql = $result['sql'];
        $filter = $result['filter'];
    }
    $user_list = $GLOBALS['db']->getAll($sql);
    // 正常查询
    if (in_array($filter['keyfields'], array('home_phone', 'mobile_phone', 'qq', 'wechat', 'aliww'))) {
        // 客服
        if (admin_priv('all', '', false) && empty($filter['admin_id'])) {
            $where = ' u.admin_id>0';
        } elseif ($filter['admin_id']) {
            if (admin_priv('all', '', false)) {
                $where = " u.admin_id={$filter['admin_id']} ";
            } elseif (admin_priv('user_part_view', '', false)) {
                $sql_select_admin = 'SELECT user_id FROM ' . $GLOBALS['ecs']->table('admin_user') . " WHERE user_id={$filter['admin_id']} AND role_id={$_SESSION['role_id']}";
                $admin_id = $GLOBALS['db']->getOne($sql_select_admin);
                if ($admin_id) {
                    $where = " u.admin_id={$filter['admin_id']} ";
                }
            } elseif (admin_priv('user_group_view', '', false)) {
                //$where = " u.group_id={$_SESSION['group_id']}";
                $where = " u.role_id={$_SESSION['role_id']}";
                if ($filter['admin_id']) {
                    $where .= " AND u.admin_id={$filter['admin_id']} ";
                }
            }
        } else {
            $where = " u.admin_id={$_SESSION['admin_id']}";
        }
        $sql_select = 'SELECT u.age_group,u.admin_name,u.user_id,u.is_black,u.user_name,u.sex,u.user_rank,' . 'u.is_validated,u.add_time,' . 'u.remarks,u.service_time FROM ' . $GLOBALS['ecs']->table('users') . ' u LEFT JOIN ' . $GLOBALS['ecs']->table('user_contact') . " uc ON u.user_id=uc.user_id WHERE {$where} AND u.customer_type IN ({$filter['type']})" . ' AND uc.contact_name="%s" AND uc.contact_value="%s"';
        switch ($filter['keyfields']) {
            case 'home_phone':
                $user_info = $GLOBALS['db']->getAll(sprintf($sql_select, 'tel', $filter['keywords']));
                break;
            case 'mobile_phone':
                $user_info = $GLOBALS['db']->getAll(sprintf($sql_select, 'mobile', $filter['keywords']));
                break;
            default:
                $user_info = $GLOBALS['db']->getAll(sprintf($sql_select, $filter['keyfields'], $filter['keywords']));
        }
        $user_list += $user_info;
    }
    $user_rank = get_rank_list();
    foreach ($user_list as &$val) {
        $val['add_time'] = date('Y-m-d', $val['add_time']);
        //$val['transfer_time'] = $val['transfer_time'] ? date('Y-m-d', $val['transfer_time']) : '-';
        $val['transfer_time'] = $val['assign_time'] ? date('Y-m-d', $val['assign_time']) : '-';
        $val['service_time'] = date('Y-m-d', $val['service_time']);
        $val['bind_time'] = date('Y-m-d', $val['bind_time']);
        $val['bind_time'] = date('Y-m-d', $val['bind_time']);
        if ($val['is_black'] == 1) {
            $val['user_name'] = '<font class="font_blacklist" >' . $val['user_name'] . '</font>';
        }
    }
    $arr = array('user_list' => $user_list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count'], 'page_size' => $filter['page_size'], 'page' => $filter['page'], 'page_set' => $page_set, 'condition' => $condition, 'start' => ($filter['page'] - 1) * $filter['page_size'] + 1, 'end' => $filter['page'] * $filter['page_size']);
    return $arr;
}
Ejemplo n.º 4
0
    $link[] = array('text' => $_LANG['back_list'], 'href' => 'bonus.php?act=list&' . list_link_postfix());
    sys_msg($_LANG['edit'] . ' ' . $_POST['type_name'] . ' ' . $_LANG['attradd_succed'], 0, $link);
}
/*------------------------------------------------------ */
//-- 红包发送页面
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'send') {
    admin_priv('bonus_manage');
    /* 取得参数 */
    $id = !empty($_REQUEST['id']) ? intval($_REQUEST['id']) : '';
    assign_query_info();
    $smarty->assign('ur_here', $_LANG['send_bonus']);
    $smarty->assign('action_link', array('href' => 'bonus.php?act=list', 'text' => $_LANG['04_bonustype_list']));
    if ($_REQUEST['send_by'] == SEND_BY_USER) {
        $smarty->assign('id', $id);
        $smarty->assign('ranklist', get_rank_list());
        $smarty->display('bonus_by_user.htm');
    } elseif ($_REQUEST['send_by'] == SEND_BY_GOODS) {
        /* 查询此红包类型信息 */
        $bonus_type = $db->GetRow("SELECT type_id, type_name FROM " . $ecs->table('bonus_type') . " WHERE type_id='{$_REQUEST['id']}'");
        /* 查询红包类型的商品列表 */
        $goods_list = get_bonus_goods($_REQUEST['id']);
        /* 查询其他红包类型的商品 */
        $sql = "SELECT goods_id FROM " . $ecs->table('goods') . " WHERE bonus_type_id > 0 AND bonus_type_id <> '{$_REQUEST['id']}'";
        $other_goods_list = $db->getCol($sql);
        $smarty->assign('other_goods', join(',', $other_goods_list));
        /* 模板赋值 */
        $smarty->assign('cat_list', cat_list());
        $smarty->assign('brand_list', get_brand_list());
        $smarty->assign('bonus_type', $bonus_type);
        $smarty->assign('goods_list', $goods_list);
Ejemplo n.º 5
0
function action_edit()
{
    // 全局变量
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    /* 检查权限 */
    admin_priv('users_manage');
    $sql = "SELECT u.user_name, u.sex, u.birthday, u.pay_points, u.rank_points, u.user_rank , u.user_money, u.frozen_money, u.credit_line, u.parent_id, u2.user_name as parent_username, u.qq, u.msn, u.office_phone, u.home_phone, u.mobile_phone" . " FROM " . $ecs->table('users') . " u LEFT JOIN " . $ecs->table('users') . " u2 ON u.parent_id = u2.user_id WHERE u.user_id='{$_GET['id']}'";
    $row = $db->GetRow($sql);
    $row['user_name'] = addslashes($row['user_name']);
    $users =& init_users();
    $user = $users->get_user_info($row['user_name']);
    /* 代码增加2014-12-23 by www.68ecshop.com _star */
    $sql = "SELECT u.user_id, u.sex, u.birthday, u.pay_points, u.rank_points, u.user_rank , u.user_money, u.frozen_money, u.credit_line, u.parent_id, u2.user_name as parent_username, u.qq, u.msn,\r\n    u.office_phone, u.home_phone, u.mobile_phone,u.real_name,u.card,u.face_card,u.back_card,u.country,u.province,u.city,u.district,u.address,u.status " . " FROM " . $ecs->table('users') . " u LEFT JOIN " . $ecs->table('users') . " u2 ON u.parent_id = u2.user_id WHERE u.user_id='{$_GET['id']}'";
    /* 代码增加2014-12-23 by www.68ecshop.com _end */
    $row = $db->GetRow($sql);
    if ($row) {
        $user['user_id'] = $row['user_id'];
        $user['sex'] = $row['sex'];
        $user['birthday'] = date($row['birthday']);
        $user['pay_points'] = $row['pay_points'];
        $user['rank_points'] = $row['rank_points'];
        $user['user_rank'] = $row['user_rank'];
        $user['user_money'] = $row['user_money'];
        $user['frozen_money'] = $row['frozen_money'];
        $user['credit_line'] = $row['credit_line'];
        $user['formated_user_money'] = price_format($row['user_money']);
        $user['formated_frozen_money'] = price_format($row['frozen_money']);
        $user['parent_id'] = $row['parent_id'];
        $user['parent_username'] = $row['parent_username'];
        $user['qq'] = $row['qq'];
        $user['msn'] = $row['msn'];
        $user['office_phone'] = $row['office_phone'];
        $user['home_phone'] = $row['home_phone'];
        $user['mobile_phone'] = $row['mobile_phone'];
        /* 代码增加2014-12-23 by www.68ecshop.com _star */
        $user['real_name'] = $row['real_name'];
        $user['card'] = $row['card'];
        $user['face_card'] = $row['face_card'];
        $user['back_card'] = $row['back_card'];
        $user['country'] = $row['country'];
        $user['province'] = $row['province'];
        $user['city'] = $row['city'];
        $user['district'] = $row['district'];
        $user['address'] = $row['address'];
        $user['status'] = $row['status'];
        /* 代码增加2014-12-23 by www.68ecshop.com _end */
    } else {
        $link[] = array('text' => $_LANG['go_back'], 'href' => 'users.php?act=list');
        sys_msg($_LANG['username_invalid'], 0, $links);
        // $user['sex'] = 0;
        // $user['pay_points'] = 0;
        // $user['rank_points'] = 0;
        // $user['user_money'] = 0;
        // $user['frozen_money'] = 0;
        // $user['credit_line'] = 0;
        // $user['formated_user_money'] = price_format(0);
        // $user['formated_frozen_money'] = price_format(0);
    }
    /* 取出注册扩展字段 */
    $sql = 'SELECT * FROM ' . $ecs->table('reg_fields') . ' WHERE type < 2 AND display = 1 AND id != 6 ORDER BY dis_order, id';
    $extend_info_list = $db->getAll($sql);
    $sql = 'SELECT reg_field_id, content ' . 'FROM ' . $ecs->table('reg_extend_info') . " WHERE user_id = {$user['user_id']}";
    $extend_info_arr = $db->getAll($sql);
    $temp_arr = array();
    foreach ($extend_info_arr as $val) {
        $temp_arr[$val['reg_field_id']] = $val['content'];
    }
    foreach ($extend_info_list as $key => $val) {
        switch ($val['id']) {
            case 1:
                $extend_info_list[$key]['content'] = $user['msn'];
                break;
            case 2:
                $extend_info_list[$key]['content'] = $user['qq'];
                break;
            case 3:
                $extend_info_list[$key]['content'] = $user['office_phone'];
                break;
            case 4:
                $extend_info_list[$key]['content'] = $user['home_phone'];
                break;
            case 5:
                $extend_info_list[$key]['content'] = $user['mobile_phone'];
                break;
            default:
                $extend_info_list[$key]['content'] = empty($temp_arr[$val['id']]) ? '' : $temp_arr[$val['id']];
        }
    }
    $smarty->assign('extend_info_list', $extend_info_list);
    /* 当前会员推荐信息 */
    $affiliate = unserialize($GLOBALS['_CFG']['affiliate']);
    $smarty->assign('affiliate', $affiliate);
    empty($affiliate) && ($affiliate = array());
    if (empty($affiliate['config']['separate_by'])) {
        // 推荐注册分成
        $affdb = array();
        $num = count($affiliate['item']);
        $up_uid = "'{$_GET['id']}'";
        for ($i = 1; $i <= $num; $i++) {
            $count = 0;
            if ($up_uid) {
                $sql = "SELECT user_id FROM " . $ecs->table('users') . " WHERE parent_id IN({$up_uid})";
                $query = $db->query($sql);
                $up_uid = '';
                while ($rt = $db->fetch_array($query)) {
                    $up_uid .= $up_uid ? ",'{$rt['user_id']}'" : "'{$rt['user_id']}'";
                    $count++;
                }
            }
            $affdb[$i]['num'] = $count;
        }
        if ($affdb[1]['num'] > 0) {
            $smarty->assign('affdb', $affdb);
        }
    }
    /* 代码增加2014-12-23 by www.68ecshop.com _star */
    $smarty->assign('lang', $_LANG);
    $smarty->assign('country_list', get_regions());
    $province_list = get_regions(1, $row['country']);
    $city_list = get_regions(2, $row['province']);
    $district_list = get_regions(3, $row['city']);
    $smarty->assign('province_list', $province_list);
    $smarty->assign('city_list', $city_list);
    $smarty->assign('district_list', $district_list);
    /* 代码增加2014-12-23 by www.68ecshop.com _end */
    assign_query_info();
    $smarty->assign('ur_here', $_LANG['users_edit']);
    $smarty->assign('action_link', array('text' => $_LANG['03_users_list'], 'href' => 'users.php?act=list&' . list_link_postfix()));
    $smarty->assign('user', $user);
    $smarty->assign('form_action', 'update');
    $smarty->assign('special_ranks', get_rank_list(true));
    $smarty->display('user_info.htm');
}