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="sel ect 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="sel ect 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');
2、登录时判断是否通过邮件验证,没通过提示需要验证邮件才能登录。
在includes/lib_mian.php里面php文件结束标签前添加:
function is_validated_emil($username)
{$sql ="SELECT is_validated" .
" FROM". $GLOBALS['ecs']->table('users').
"WHERE user_name='" . $username."'";
return$GLOBALS['db']->getOne($sql);
}用于检测邮箱验证状态!。
修改user.php大约349行
也可查找:if($user->login($username,$password,isset($_POST['remember'])))
在下面把:update_user_info();
recalculate_price();
$ucdata = isset($user->ucdata)?$user->ucdata : '';
show_message($_LANG['login_success'] . $ucdata ,array($_LANG['back_up_page'], $_LANG['profile_lnk']),array($back_act,'user.php'), 'info');
改成:if(is_validated_emil($username) >0)
{update_user_info();
recalculate_price();
$ucdata = isset($user->ucdata)?$user->ucdata : '';
show_message($_LANG['login_success'] . $ucdata ,array($_LANG['back_up_page'], $_LANG['profile_lnk']),array('user.php','user.php'), 'info');
}$user->logout();
show_message('需要验证邮件才能登录',array($_LANG['back_up_page'], $_LANG['back_home_lnk']),array('user.php', 'index.php'), 'info');
}购物流程时登录也要相应的修改
打开flow.php大约239行
查找:if($user->login($_POST['username'],$_POST['password'],isset($_POST['remember'])))
将下面的代码:update_user_info(); //更新用户信息
recalculate_price(); //重新计算购物车中的商品价格
$sql = "SELECT COUNT(*) FROM" . $ecs->table('cart') . " WHERE session_id = '" . SESS_ID . "'";
if ($db->getOne($sql) >0)
{ecs_header("Location:flow.php?step=checkout\n");
}ecs_header("Location:index.php\n");
}if(is_validated_emil($_POST['username'])> 0)
{update_user_info(); //更新用户信息
recalculate_price(); // 重新计算购物车中的商品价格
$sql = "SELECT COUNT(*) FROM " .$ecs->table('cart') . " WHERE session_id = '" . SESS_ID . "'";
if ($db->getOne($sql) > 0)
{ecs_header("Location:flow.php?step=checkout\n");
}else{ecs_header("Location:index.php\n");
}$user->logout();
show_message('需要验证邮件才能登录',array($_LANG['back_up_page'], $_LANG['back_home_lnk']),array('flow.phpstep=login', 'index.php'), 'info');
}