Ecshop模板来做二次开发注册后自动发送电子邮件验证,验证成功的能够登录:
,可以提示用户注册验证邮件立即
第二,检查后促进筛选有效的邮箱
现在下面的模板如何注册自动发送电子邮件验证,验证成功的能够登录:
1、自动注册电子邮件和注销状态,提示需要验证邮箱登录。
- 在user.php大约233行很234行
- 把:
- $ucdata = empty($user->ucdata)? “” : $user->ucdata;
- show_message(sprintf($_LANG[‘register_success’], $username . $ucdata), array($_LANG[‘back_up_page’], $_LANG[‘profile_lnk’]), array($back_act, ‘user.php’),
- ‘info’);
- 替换成:
- $cfg = $_CFG[‘smtp_user’];
- if(!empty($cfg) )
- {
- $sql=”select user_id from “.$GLOBALS[‘ecs’]->table(‘users’) .”where user_name = ‘$username’”;
- $user_id=$db->getOne($sql);
- send_regiter_hash ($user_id);
- }
- $user->logout();
- show_message(‘需要验证邮件才能登录’, array($_LANG[‘back_up_page’], $_LANG[‘back_home_lnk’]), array(‘user.php’, ‘index.php’), ‘info’);
- 购物流程时注册也要相应的修改
- 打开flow.php大约282行
- 查找:
- if (register(trim($_POST[‘username’]), trim($_POST[‘password’]), trim($_POST[’email’])))
- 将下面代码:
- /* 用户注册成功 */
- ecs_header(“Location: flow.php?step=consignee\n”);
- exit;
- 替换成:
- $cfg = $_CFG[‘smtp_user’];
- if(!empty($cfg) )
- {
- $sql=”select user_id from “.$GLOBALS[‘ecs’]->table(‘users’) .”where user_name = ‘”.trim($_POST[‘username’]).”‘”;
- $user_id=$db->getOne($sql);
- send_regiter_hash ($user_id);
- }
- $user->logout();
- show_message(‘需要验证邮件才能登录’, array($_LANG[‘back_up_page’], $_LANG[‘back_home_lnk’]), array(‘flow.php?step=login’, ‘index.php’), ‘info’);