ecshop设置会员头像
ecshop 会员头像 ################ 数据库 ################ 1、ecs_users 表加入 avatar 字段 ALTER TABLE `ecs_users` ADD `avatar` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' ################ 前端 ################2、themes\default\user_clips.dwt 用户中心默认显示页面 显示头像(新会员显示系统默认的头像) <!-- *用户中心默认显示页面 start--> <!-- {if $action eq 'default'} --> <style> .avtar .img a{display:none;width:72px;height:23px;background:url(images/change_avtar.gif);position:absolute;margin-left:44px;margin-top:93px} .avtar .hover a{display:block} .Left .img{border:1px solid #d0d0d0;margin-bottom:5px} .Left .img,.Left .img img{width:120px;height:120px} </style> <div class="Left avtar" style="float:left;width:122px;text-align:center;"><div οnmοuseοut="this.className='img'" οnmοuseοver="this.className='img hover'" class="img"><a title="修改我的头像" href="user.php?act=profile" class="red"></a><img src="{if $info.avatar}{$info.avatar}{else}images/avatar.gif{/if}"></div> </div>3、themes\default\user_transaction.dwt 用户信息修改页面 <!-- 用户信息界面 start--> <!--{if $action eq 'profile'}--> 里面找到 <form name="formEdit" action="user.php" method="post" onSubmit="return userEdit()"> 修改成 <form name="formEdit" action="user.php" method="post" onSubmit="return userEdit()" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="1097152" /><!-- 1M图片上传大小设置 -->再找到submit提交之前加入 <tr><td width="28%" align="right" bgcolor="#FFFFFF">会员头像:</td><td width="72%" align="left" bgcolor="#FFFFFF"><div style="width:50%;float:left;"><input id="avatar" type="file" size="40" value="" name="avatar"><br/><span style="color:#FF0000"> 图片像素最佳为55px * 55px,<br/>大小不得超过1M</span></div><div style="width:50%;float:left;"><img src="{if $profile.avatar}{$profile.avatar}{else}images/avatar.gif{/if}" alt="" width="55" height="55"></div></td> </tr>################ php 逻辑处理 ################ 1、user.php 里面找到 require(dirname(__FILE__) . '/includes/init.php'); 它的下面加入 include_once(ROOT_PATH . '/includes/cls_image.php');//会员头像 by neo $image = new cls_image($_CFG['bgcolor']);//会员头像 by neo $allow_suffix = array('gif', 'jpg', 'png', 'jpeg', 'bmp');//会员头像 by neo继续找到 /* 更新用户扩展字段的数据 */ 在它的上面加入 $avatar = isset($_POST['avatar']) ? $_POST['avatar'] : '';//会员头像 by neo继续找 if (!empty($mobile_phone) && !preg_match('/^[\d-\s]+$/', $mobile_phone)) {show_message($_LANG['passport_js']['mobile_phone_invalid']); } 它下面加入 /* 检查图片:如果有错误,检查尺寸是否超过最大值;否则,检查文件类型 */if (isset($_FILES['avatar']['error'])) // php 4.2 版本才支持 error{// 最大上传文件大小 $php_maxsize = ini_get('upload_max_filesize');$htm_maxsize = '1M';// 会员头像 if ($_FILES['avatar']['error'] == 0){if (!$image->check_img_type($_FILES['avatar']['type'])){show_message("图片格式不正确!");}}elseif ($_FILES['avatar']['error'] == 1){show_message(sprintf('图片文件太大了(最大值:1M),无法上传。', $php_maxsize), $_LANG['profile_lnk'], 'user.php?act=profile', 'info');}elseif ($_FILES['avatar']['error'] == 2){show_message(sprintf('图片文件太大了(最大值:1M),无法上传。', $htm_maxsize), $_LANG['profile_lnk'], 'user.php?act=profile', 'info');}}/* 4.1版本 */else{// 会员头像 if ($_FILES['avatar']['tmp_name'] != 'none'){if (!$image->check_img_type($_FILES['avatar']['type'])){show_message("图片格式不正确!");}}}//会员头像 by neoif (!empty($_FILES['avatar']['name'])){/* 更新会员头像之前先删除旧的头像 */$sql = "SELECT avatar " ." FROM " . $GLOBALS['ecs']->table('users') ." WHERE user_id = '$user_id'";$row = $GLOBALS['db']->getRow($sql);if ($row['avatar'] != ''){@unlink($row['avatar']);}$img_name = $user_id . '.' . end(explode('.', $_FILES['avatar']['name']));$target = ROOT_PATH . DATA_DIR . '/avatar/';$original_img = $image->upload_image($_FILES['avatar'], 'avatar', $img_name); // 原始图片 $avatar = $image->make_thumb($original_img, 55, 55, $target);if ($avatar === false){show_message("图片保存出错!");}}在它的下面还有个 $profile = array('user_id' => $user_id,'email' => isset($_POST['email']) ? trim($_POST['email']) : '','sex' => isset($_POST['sex']) ? intval($_POST['sex']) : 0,'birthday' => $birthday,'other' => isset($other) ? $other : array()); 修改成 $profile = array('user_id' => $user_id,'email' => isset($_POST['email']) ? trim($_POST['email']) : '','sex' => isset($_POST['sex']) ? intval($_POST['sex']) : 0,'birthday' => $birthday,'avatar' => $avatar,//会员头像 by neo'other' => isset($other) ? $other : array());2、includes\lib_clips.php 找到 function get_user_default($user_id) {$user_bonus = get_user_bonus();$sql = "SELECT pay_points, user_money, credit_line, last_login, is_validated FROM " .$GLOBALS['ecs']->table('users'). " WHERE user_id = '$user_id'"; 加入字段 function get_user_default($user_id) {$user_bonus = get_user_bonus();//会员头像 by neo$sql = "SELECT pay_points, user_money, credit_line, last_login, is_validated, avatar FROM " .$GLOBALS['ecs']->table('users'). " WHERE user_id = '$user_id'";$row = $GLOBALS['db']->getRow($sql);继续下面中的 $info = array(); 加入字段 $info['avatar'] = $row['avatar'];//会员头像 by neo3、includes\lib_transaction.php 找到 if (!$GLOBALS['user']->edit_user($cfg)) 在它的前面加入 //会员头像 if (!empty($profile['avatar'])) {$cfg['avatar'] = $profile['avatar']; }继续找到 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 "."FROM " .$GLOBALS['ecs']->table('users') . " WHERE user_id = '$user_id'"; 加入字段 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, avatar ".//会员头像 by neo"FROM " .$GLOBALS['ecs']->table('users') . " WHERE user_id = '$user_id'";继续找到下面的 $info['birthday'] = isset($infos['birthday']) ? $infos['birthday'] : ''; 在它的下面加入 $info['avatar'] = isset($infos['avatar']) ? $infos['avatar'] : '';//会员头像 by neo4、includes\modules\integrates\integrate.php 里面找到 var $error = 0; 它的下面加入 /* 会员头像 by neo */ var $field_avatar = '';继续找到 if ((!empty($cfg['bday'])) && $this->field_bday != 'NULL') {$values[] = $this->field_bday . "='" . $cfg['bday'] . "'"; } 在它的下面加入 //会员头像 by neo if ((!empty($cfg['avatar'])) && $this->field_avatar != 'NULL') {$values[] = $this->field_avatar . "='" . $cfg['avatar'] . "'"; }5、includes\modules\integrates\ecshop.php 找到 $this->field_reg_date = 'reg_time'; 下面加入 $this->field_avatar = 'avatar';//会员头像 by neo################ 后台 ################ 1、admin\templates\user_info.htm 找到 <form method="post" action="users.php" name="theForm" οnsubmit="return validate()"> 改成 <form method="post" action="users.php" name="theForm" οnsubmit="return validate()" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="1097152" /><!-- 1M图片上传大小设置 -->继续找 <tr><td class="label">{$lang.email}:</td><td><input type="text" name="email" maxlength="60" size="40" value="{$user.email}" />{$lang.require_field}</td></tr> 它的下面加入 <tr><td width="28%" align="right" class="label">会员头像:</td><td width="72%" align="left" bgcolor="#FFFFFF"><div style="width:50%;float:left;"><input id="avatar" type="file" size="40" value="" name="avatar"><br/><span style="color:#FF0000"> 图片像素最佳为55px * 55px,<br/>大小不得超过1M</span></div><div style="width:50%;float:left;"><img src="../{if $user.avatar}{$user.avatar}{else}images/avatar.gif{/if}" alt="" width="55" height="55"></div></td> </tr>2、admin\users.php 找到头部的 require(dirname(__FILE__) . '/includes/init.php'); 下面加入 include_once(ROOT_PATH . '/includes/cls_image.php');//会员头像 by neo $image = new cls_image($_CFG['bgcolor']);//会员头像 by neo $allow_suffix = array('gif', 'jpg', 'png', 'jpeg', 'bmp');//会员头像 by neo找到 $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,u.office_phone, u.home_phone, u.mobile_phone". 修改成 $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,u.office_phone, u.home_phone, u.mobile_phone, u.avatar".//会员头像 by neo下面的 $user['mobile_phone'] = $row['mobile_phone']; 它的下面加入 $user['avatar'] = $row['avatar'];//会员头像 by neo这样,后台编辑会员 就能看到会员的头像了。接下来,处理后台修改会员头像的提交逻辑处理 继续找到 elseif ($_REQUEST['act'] == 'update') 下面的 $credit_line = empty($_POST['credit_line']) ? 0 : floatval($_POST['credit_line']); 它的下面加入 $user_id = empty($_POST['id']) ? '' : trim($_POST['id']);//会员头像 by neo/* 检查图片:如果有错误,检查尺寸是否超过最大值;否则,检查文件类型 */if (isset($_FILES['avatar']['error'])) // php 4.2 版本才支持 error{// 最大上传文件大小 $php_maxsize = ini_get('upload_max_filesize');$htm_maxsize = '1M';// 会员头像 if ($_FILES['avatar']['error'] == 0){if (!$image->check_img_type($_FILES['avatar']['type'])){sys_msg("图片格式不正确!", 1, array(), false);}}elseif ($_FILES['avatar']['error'] == 1){sys_msg(sprintf('图片文件太大了(最大值:1M),无法上传。', $php_maxsize), 1, array(), false);}elseif ($_FILES['avatar']['error'] == 2){sys_msg(sprintf('图片文件太大了(最大值:1M),无法上传。', $htm_maxsize), 1, array(), false);}}/* 4.1版本 */else{// 会员头像 if ($_FILES['avatar']['tmp_name'] != 'none'){if (!$image->check_img_type($_FILES['avatar']['type'])){sys_msg("图片格式不正确!");}}}//会员头像 by neoif (!empty($_FILES['avatar']['name'])){/* 更新会员头像之前先删除旧的头像 */$sql = "SELECT avatar " ." FROM " . $GLOBALS['ecs']->table('users') ." WHERE user_id = '$user_id'";$row = $GLOBALS['db']->getRow($sql);if ($row['avatar'] != ''){@unlink('../' . $row['avatar']);}$img_name = $user_id . '.' . end(explode('.', $_FILES['avatar']['name']));$target = ROOT_PATH . DATA_DIR . '/avatar/';$original_img = $image->upload_image($_FILES['avatar'], 'avatar', $img_name); // 原始图片 $avatar = $image->make_thumb('../' . $original_img, 55, 55, $target);if ($avatar === false){sys_msg("图片保存出错!");}}下面一行的 if (!$users->edit_user(array('username'=>$username, 'password'=>$password, 'email'=>$email, 'gender'=>$sex, 'bday'=>$birthday ), 1)) 加入字段 if (!$users->edit_user(array('username'=>$username, 'password'=>$password, 'email'=>$email, 'gender'=>$sex, 'bday'=>$birthday, 'avatar'=>$avatar ), 1))//会员头像 by neo
ecshop设置会员头像相关推荐
- 微信一键设置“姓氏头像”,学起来!
哈喽,大家好.今天给大家带来一款特别的姓氏头像工具,可以给你的头像右下角加上自己的姓氏,速看效果! 是不是还蛮特别的?无论是安卓还是iOS用户都可以使用,接下来就教大家怎么操作. 小贴士:工具获取方式 ...
- 8种bootstrap团队会员头像样式代码
下载地址 8种bootstrap团队会员头像样式代码,基于bootstrap框架实现的会员头像图文描述,团队组成人员列表介绍,带css3鼠标悬停动画效果. dd:
- 苹果cmsV10 会员收费设置 会员VIP权限设置教程
苹果cmsV10 会员收费设置 会员VIP权限设置教程 带会员模块的模板免费分享 苹果cms资源网 获取! 首先要开启会员模块,在系统,会员参数配置中开启 开启后,如果你的网站模板有会员模块,就可以在 ...
- 会员权益营销中,设置会员权益的三个标准
会员权益营销对于一些搭建会员营销体系的企业来说并不是一个陌生的营销方式,企业想要通过会员营销体系达成企业的商业目标,那么在运营过程中就绕不开会员权益营销,只有将会员权益营销做好,那么才能更好的吸引用户 ...
- zblogphp登录和注册_zblog如何设置会员注册功能
在独立ip虚拟主机环境下建设网站时,使用会员功能不仅可以作为站长统计数据的一种方式,而且也可以让自己的网站的内部信息增加一定的保护,还可以减少恶意评论和恶意灌水的行为.而现在绝大部分的网站程序都已经在 ...
- Discuz 会员头像调用方法之discuz_uc_avatar函数
现在Discuz越来越走向开放化,只要会网站技术都可以对DZ的程序进行修改,还可以开发插件和模板等.UCenter用户中心是很重要的,它是很多应用的中心.其中会员头像就是通过UC调用的.大家可以发现头 ...
- php增加vip等级设置,会员管理系统中商家如何设置会员等级
会员等级的诞生,从商家的角度来看是为了促进顾客.会员更多的消费:从会员的角度来看,是一种会员身份的象征,从会员等级中,会员可以享受不同的折扣与优惠.那么商家应该如何来给我们的会员设置等级呢?怎么设才最 ...
- Android Studio 环信IM聊天设置用户头像
环信IM中的DemoHelper提供了实现设置聊天头像的方法,但是我们有时候不希望按照demo的基础进行开发,或者把整个demo作为依赖导入主项目中.其实在easeui中提供了一个EaseUserPr ...
- PageAdmin CMS网站制作教程:如何设置会员中心权限?
PageAdmin CMS网站建设教程:如何设置会员中心权限? 登录后台地址,进入后台界面,在顶部导航中找到用户,并点击: 在左侧导航中找到会员组管理,并点击: 3. 找到要设置的会员组,点击菜单权限 ...
- cocos creator设置网络头像
设置网络头像的方法: 方法如下: util.setNetworkHead = function(sprite, path) {cc.assetManager.loadRemote(path, { ex ...
最新文章
- .net core 注入中的三种模式:Singleton、Scoped 和 Transient
- 设计模式的概念和分类
- js - flex布局测试案例:完美居中
- 2011(信息学奥赛一本通-T1234)
- 深入理解JavaScript系列(6):S.O.L.I.D五大原则之单一职责SRP
- 本地上支持apache多站点访问
- LINUX下,ffmpeg增加NVIDIA硬件编解码的步骤及解决办法
- 深度学习caffe:损失函数
- 阿里巴巴《rocketmq开发指南》_主流消息中间件优劣:ActiveMQ,RabbitMQ,Kafka,RocketMQ...
- WPS Linux版的公式自动编号且右对齐的方法
- 哪里有周末java培训_北京哪里里Java周末学习班
- 弹性布局和AndroidAutoSize屏幕适配
- 【强化学习1.0】导论 多臂赌博机问题(multi-armed bandit)
- shell了解MySQL_MySQLShell:01从入门到蒙圈
- Unity3dAndroid Studio实现开机自启App以及激活其他App
- 【数据结构与算法】-6.1图的基本概念和术语
- 小学带计算机2000的检讨书,小学生的检讨书(精选10篇)
- 三维空间中绘制点、线、面、UV贴图,万能的BufferGeometry(three.js实战4)
- Abbkine细胞周期染色试剂盒特色和实验建议
- 2万字Linux实用常用命令总结,收藏不吃灰~