예제 #1
0
            if (!$validator->check_word($_POST['captcha'])) {
                show_message($_LANG['invalid_captcha'], $_LANG['sign_up'], 'user.php?act=register', 'error');
            }
        }
        if (register($username, $password, $email, $other) !== false) {
            $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');
        } else {
            $err->show($_LANG['sign_up'], 'user.php?act=register');
        }
    }
} 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 = "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);
            show_message(sprintf($_LANG['validate_ok'], $row['user_name'], $row['email']), $_LANG['profile_lnk'], 'user.php');
        }
    }
    show_message($_LANG['validate_fail']);
} elseif ($action == 'is_registered') {
    include_once ROOT_PATH . 'includes/lib_passport.php';
    $username = trim($_GET['username']);
    $username = json_str_iconv($username);
    if ($user->check_user($username) || admin_registered($username)) {
        echo 'false';
예제 #2
0
파일: user.php 프로젝트: seanguo166/yinoos
function action_validate_email()
{
    // 获取全局变量
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    $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 = "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);
            show_message(sprintf($_LANG['validate_ok'], $row['user_name'], $row['email']), $_LANG['profile_lnk'], 'user.php');
        }
    }
    show_message($_LANG['validate_fail']);
}
예제 #3
0
/**
 * Send referral email
 * @param   string      $referral_id referral record id
 * @return  boolean
 */
function send_referral_email($referral_id)
{
    $sql = "SELECT referral_email, user_id FROM " . $GLOBALS['ecs']->table('user_referral') . " WHERE id = '$referral_id'";
    $referral = $GLOBALS['db']->getRow($sql);

    $sql = "SELECT user_name, email FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '" . $referral['user_id'] . "'";
    $row = $GLOBALS['db']->getRow($sql);

    $email = $referral['referral_email'];

    $hash = register_hash('encode', $referral_id);
    $referral_comfirm_url = $GLOBALS['ecs']->url() . 'user.php?act=register_referral&hash=' . $hash;


    $name = '';
    $template    = get_mail_template('referral_email_confirm');
    $subject = $template['template_subject'];
    $type = $template['is_html'];

    $GLOBALS['smarty']->assign('user_name',            $row['email']);
    $GLOBALS['smarty']->assign('referral_comfirm_url', $referral_comfirm_url);
    $GLOBALS['smarty']->assign('shop_name',            $GLOBALS['_CFG']['shop_name']);
    $GLOBALS['smarty']->assign('send_date',            date($GLOBALS['_CFG']['date_format']));

    $content = $GLOBALS['smarty']->fetch('str:' . $template['template_content']);

    if(send_mail($name, $email, $subject, $content, $type))
    {
        return true;
    }
    else
    {
        return false;
    }
}
예제 #4
0
/**
 *  发送激活验证邮件
 *
 * @access  public
 * @param   int     $user_id        用户ID
 *
 * @return boolen
 */
function send_regiter_hash($user_id)
{
    /* 设置验证邮件模板所需要的内容信息 */
    $template = get_mail_template('register_validate');
    $hash = register_hash('encode', $user_id);
    $validate_email = $GLOBALS['ecs']->url() . 'user.php?act=validate_email&hash=' . $hash;
    $sql = "SELECT user_name, email FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '{$user_id}'";
    $row = $GLOBALS['db']->getRow($sql);
    $GLOBALS['smarty']->assign('user_name', $row['user_name']);
    $GLOBALS['smarty']->assign('validate_email', $validate_email);
    $GLOBALS['smarty']->assign('shop_name', $GLOBALS['_CFG']['shop_name']);
    $GLOBALS['smarty']->assign('send_date', date($GLOBALS['_CFG']['date_format']));
    $content = $GLOBALS['smarty']->fetch('str:' . $template['template_content']);
    /* 发送激活验证邮件 */
    if (send_mail($row['user_name'], $row['email'], $template['template_subject'], $content, $template['is_html'])) {
        return true;
    } else {
        return false;
    }
}
예제 #5
0
파일: user.php 프로젝트: rainmore/Enovor
/* referral注册会员的处理 */
elseif ($action == 'act_register_referral')
{
    $hash  = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false;
    /* 增加是否关闭注册 */
    if ($_CFG['shop_referral_closed'])
    {
        $smarty->assign('action',     'register_referral');
        $smarty->assign('shop_reg_closed', !$_CFG['shop_reg_closed'] && $_CFG['shop_referral_closed']);
        $smarty->assign('shop_referral_closed', $_CFG['shop_referral_closed']);
        $smarty->display('user_passport.dwt');
    } else if (!$hash) {
        show_message($_LANG['referral_register_invalid_hash']);
    } else {
        include_once(ROOT_PATH . 'includes/lib_passport.php');
        $referral_id = register_hash('decode', $hash);
        $sql = "SELECT referral_email, user_id, registered_date, registered_user_id FROM " . $ecs->table('user_referral') . " WHERE is_active = 1 AND id = '" . mysql_real_escape_string($referral_id) . "'";
        $referral = $db->getRow($sql);

        $username = isset($_POST['username']) ? trim($_POST['username']) : '';
        $password = isset($_POST['password']) ? trim($_POST['password']) : '';
        $email    = isset($_POST['email']) ? trim($_POST['email']) : $referral['referral_email'];
        $other['msn'] = isset($_POST['extend_field1']) ? $_POST['extend_field1'] : '';
        $other['qq'] = isset($_POST['extend_field2']) ? $_POST['extend_field2'] : '';
        $other['office_phone'] = isset($_POST['extend_field3']) ? $_POST['extend_field3'] : '';
        $other['home_phone'] = isset($_POST['extend_field4']) ? $_POST['extend_field4'] : '';
        $other['mobile_phone'] = isset($_POST['extend_field5']) ? $_POST['extend_field5'] : '';
        $sel_question = empty($_POST['sel_question']) ? '' : $_POST['sel_question'];
        $passwd_answer = isset($_POST['passwd_answer']) ? trim($_POST['passwd_answer']) : '';

        $back_act = isset($_POST['back_act']) ? trim($_POST['back_act']) : '';