Ecshop邮件验证赠送积分

主要涉及到includes/lib_common.php和user.php两个文件的修改。
1.  Lib_common.php里面有log_account_change的函数.它有两个作用,一是调整注册用户积分调整记录日志,二是修改个人账户的积分了。
2.  在user.php相应位置做如下修改,实现邮件验证后赠送积分以及重复验证邮件会重复赠送积分的Bug问题。
elseif ($action == ‘validate_email’)
{
$hash = empty($_GET['hash']) ? ” : trim($_GET['hash']);
if ($hash)
{
include_once(ROOT_PATH . ‘includes/lib_passport.php’);
$id = register_hash(‘decode’, $hash);
if ($id > 0)
{
$sql = ‘SELECT is_validated FROM ‘.$ecs->table(‘users’).” WHERE user_id=’$id’”;
$row = $db->getRow($sql);
if($row['is_validated'] == 0)
{
$sql = “UPDATE ” . $ecs->table(‘users’) . ” SET is_validated = 1 WHERE user_id=’$id’”;
$db->query($sql);
$sql = ‘SELECT user_name, email FROM ‘ . $ecs->table(‘users’) . ” WHERE user_id = ‘$id’”;
$row = $db->getRow($sql);
//验证完成 送积分
include_once(ROOT_PATH .’includes/lib_common.php’);
log_account_change($id, 0, 0, 0, 500,$GLOBALS['_LANG']['register_points']);
show_message(sprintf($_LANG['validate_ok'], $row['user_name'], $row['email']),$_LANG['profile_lnk'], ‘user.php’);

}
else
{
show_message(sprintf(‘请不要重复验证’, $row['user_name'], $row['email']),$_LANG['profile_lnk'], ‘user.php’);
}
}
}
show_message($_LANG['validate_fail']);
}

Leave a comment

Your comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word