一、数据库结构修改
1、用phpMyAdmin打开mysql数据库
2、选择表“ecs_users ”
3】添加你想要加的字段
二、修改模板文件
修改themes/你所选模板目录下/user_transaction.dwt文件
<tr>
<td width="28%" align="right" bgcolor="#FFFFFF">{$lang.other_mobile_phone}:</td>
<td width="72%" align="left" bgcolor="#FFFFFF"><input name="other[mobile_phone]" type="text" value="{$profile.mobile_phone}" class="formBorder" />
</td>
</tr>
<tr>
<td width="28%" align="right" bgcolor="#FFFFFF">{$lang.other_family_birthday}:</td>
<td width="72%" align="left" bgcolor="#FFFFFF"><input name="extend_field6" type="text" value="{$profile.family_birthday}" class="formBorder" />
</td>
</tr>
三修改php文件
1.修改根目录下的user.php
/* 修改个人资料的处理 */
elseif ($action == 'act_edit_profile')
{
include_once(ROOT_PATH . 'includes/lib_transaction.php');
$birthday = trim($_POST['birthdayYear']) .'-'. trim($_POST['birthdayMonth']) .'-'.
trim($_POST['birthdayDay']);
$email = trim($_POST['email']);
$other['msn'] = $msn = isset($_POST['extend_field1']) ? trim($_POST['extend_field1']) : '';
$other['qq'] = $qq = isset($_POST['extend_field2']) ? trim($_POST['extend_field2']) : '';
$other['office_phone'] = $office_phone = isset($_POST['extend_field3']) ? trim($_POST['extend_field3']) : '';
$other['home_phone'] = $home_phone = isset($_POST['extend_field4']) ? trim($_POST['extend_field4']) : '';
$other['mobile_phone'] = $mobile_phone = isset($_POST['extend_field5']) ? trim($_POST['extend_field5']) : '';
$sel_question = empty($_POST['sel_question']) ? '' : compile_str($_POST['sel_question']);
$passwd_answer = isset($_POST['passwd_answer']) ? compile_str(trim($_POST['passwd_answer'])) : '';
$other['family_birthday'] = $family_birthday = isset($_POST['extend_field6']) ? trim($_POST['extend_field6']) : '';
2.修改includes/lib_transaction.php
/* 过滤非法的键值 */
$other_key_array = array('msn', 'qq', 'office_phone', 'home_phone', 'mobile_phone', 'family_birthday', 'family_type');
foreach ($profile['other'] as $key => $val)
{
//删除非法key值
if (!in_array($key, $other_key_array))
{
unset($profile['other'][$key]);
}
else
{
$profile['other'][$key] = htmlspecialchars(trim($val)); //防止用户输入javascript代码
}
}
/**
* 获取用户帐号信息
*
* @access public
* @param int $user_id 用户user_id
*
* @return void
*/
function get_profile($user_id)
{
global $user;
/* 会员帐号信息 */
$info = array();
$infos = array();
$sql = "SELECT user_name, birthday, sex, question, answer, rank_points, pay_points,user_money, user_rank,".
" msn, qq, office_phone, home_phone, mobile_phone, passwd_question, passwd_answer,family_birthday,family_type ".
"FROM " .$GLOBALS['ecs']->table('users') . " WHERE user_id = '$user_id'";
$infos = $GLOBALS['db']->getRow($sql);
$infos['user_name'] = addslashes($infos['user_name']);
$row = $user->get_profile_by_name($infos['user_name']); //获取用户帐号信息
$_SESSION['email'] = $row['email']; //注册SESSION
/* 会员等级 */
if ($infos['user_rank'] > 0)
{
$sql = "SELECT rank_id, rank_name, discount FROM ".$GLOBALS['ecs']->table('user_rank') .
" WHERE rank_id = '$infos[user_rank]'";
}
else
{
$sql = "SELECT rank_id, rank_name, discount, min_points".
" FROM ".$GLOBALS['ecs']->table('user_rank') .
" WHERE min_points<= " . intval($infos['rank_points']) . " ORDER BY min_points DESC";
}
if ($row = $GLOBALS['db']->getRow($sql))
{
$info['rank_name'] = $row['rank_name'];
}
else
{
$info['rank_name'] = $GLOBALS['_LANG']['undifine_rank'];
}
$cur_date = date('Y-m-d H:i:s');
/* 会员红包 */
$bonus = array();
$sql = "SELECT type_name, type_money ".
"FROM " .$GLOBALS['ecs']->table('bonus_type') . " AS t1, " .$GLOBALS['ecs']->table('user_bonus') . " AS t2 ".
"WHERE t1.type_id = t2.bonus_type_id AND t2.user_id = '$user_id' AND t1.use_start_date <= '$cur_date' ".
"AND t1.use_end_date > '$cur_date' AND t2.order_id = 0";
$bonus = $GLOBALS['db']->getAll($sql);
if ($bonus)
{
for ($i = 0, $count = count($bonus); $i < $count; $i++)
{
$bonus[$i]['type_money'] = price_format($bonus[$i]['type_money'], false);
}
}
$info['discount'] = $_SESSION['discount'] * 100 . "%";
$info['email'] = $_SESSION['email'];
$info['user_name'] = $_SESSION['user_name'];
$info['rank_points'] = isset($infos['rank_points']) ? $infos['rank_points'] : '';
$info['pay_points'] = isset($infos['pay_points']) ? $infos['pay_points'] : 0;
$info['user_money'] = isset($infos['user_money']) ? $infos['user_money'] : 0;
$info['sex'] = isset($infos['sex']) ? $infos['sex'] : 0;
$info['birthday'] = isset($infos['birthday']) ? $infos['birthday'] : '';
$info['question'] = isset($infos['question']) ? htmlspecialchars($infos['question']) : '';
$info['user_money'] = price_format($info['user_money'], false);
$info['pay_points'] = $info['pay_points'] . $GLOBALS['_CFG']['integral_name'];
$info['bonus'] = $bonus;
$info['qq'] = $infos['qq'];
$info['msn'] = $infos['msn'];
$info['office_phone']= $infos['office_phone'];
$info['home_phone'] = $infos['home_phone'];
$info['mobile_phone'] = $infos['mobile_phone'];
$info['passwd_question'] = $infos['passwd_question'];
$info['passwd_answer'] = $infos['passwd_answer'];
$info['family_birthday'] = $infos['family_birthday'];
$info['family_type'] = $infos['family_type'];
return $info;
}
相关文章
ecshop出现Warning: Invalid argument supplied for foreach()错误2019-02-26
Ecshop 分类页产品列表不同分类调用不同产品属性2018-03-08
ECSHOP商品属性调用到任意页面方法2018-03-01
ECSHOP商品列表页显示每个商品的品牌2018-02-28
Ecshop 分类页品牌调用商品数量2018-02-28
ecshop调整默认商品图片排序2018-02-27
ecshop各个页面调用商品销售量方法2016-09-23
ecshop mobile首页循环显示分类及分类下商品2016-09-23
ecshop后台添加虚拟销量以及前台显示销量2016-09-22
ecshop重新导入数据库,管理员和密码正确登录失败2016-09-21