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');
(责任编辑:最模板) |