예제 #1
0
function registerUser($mobileNum, $md5Password)
{
    $ec_salt = rand(1000, 9999);
    $password = md5($md5Password . $ec_salt);
    $rankId = getNewUserRankId();
    $sql = "INSERT INTO " . $GLOBALS['ecs']->table('users') . "(user_name, ec_salt, mobile_phone, chat_validated, password, user_rank) VALUES('{$mobileNum}', '{$ec_salt}', '{$mobileNum}', 2, '{$password}', {$rankId})";
    if ($GLOBALS['db']->query($sql)) {
        require_once WEB_ROOT . '/includes/lib_integral.php';
        $userId = $GLOBALS['db']->insert_id();
        user_get_point($GLOBALS['_CFG']['validated_integral'], $userId, 4, '手机验证获得积分', 0);
        user_has_got_integral('phone', $userId);
        return true;
    }
    return false;
}
예제 #2
0
         exit;
     }
     $sql = "INSERT INTO " . $GLOBALS['ecs']->table('comment') . " (comment_type, id_value, \temail, user_name, content, comment_rank, add_time, ip_address, status, parent_id, user_id, order_id, is_anonymity) VALUES(1, '{$id_value}', '', '" . $_SESSION['user_name'] . "', '{$content}', {$comment_rank}, {$add_time}, '" . $_SESSION['last_ip'] . "', 1, 0, '" . $_SESSION['user_id'] . "', '', 0)";
     if ($GLOBALS['db']->query($sql)) {
         $smarty->assign('redrectUrl', $_SERVER['HTTP_REFERER']);
         $smarty->assign('smalltext', '已评论');
         $smarty->assign('content', '您成功评论。3秒后将返回上一页,如果未跳转请');
         $smarty->assign('action', 'pageRedirect');
         $smarty->display('user_passport.dwt');
     } else {
         show_message("评论失败", '', '', 'error');
     }
     exit;
 } else {
     if ($_REQUEST['act'] == 'get_shaidanIntegral') {
         user_get_point($_CFG['comment_shaidan'], $_SESSION['user_id'], 1, "晒单获得额外积分", 0);
         echo "晒单获得" . $_CFG['comment_shaidan'] . "积分";
         exit;
     } else {
         if ($_REQUEST['act'] == 'ajax_isCommented') {
             $order_id = isset($_REQUEST['order_id']) ? $_REQUEST['order_id'] : '';
             $comment_id = isCommentOrNot($order_id);
             if ($comment_id) {
                 echo '1';
             } else {
                 echo '0';
             }
             die;
         } else {
             if ($_REQUEST['act'] == 'gotopage') {
                 $cmt = new stdClass();
예제 #3
0
파일: user.php 프로젝트: norain2050/benhu
            break;
        default:
            break;
    }
    if (!$written_val['bday']) {
        $where .= " bday='{$bday}', ";
    }
    $sql = "UPDATE " . $ecs->table('users') . "SET {$where} sex='{$sex}',truename='{$truename}',nickname='{$nickname}',home_phone='{$home_phone}',qq='{$qq}',email='{$email}',msn='{$msn}',province='{$province}',city='{$city}',area='{$area}',bname='{$bname}',bsex='{$bsex}'  WHERE user_id= '" . $user_id . "'";
    $a = $db->query($sql);
    include_once ROOT_PATH . 'includes/lib_user_info.php';
    require_once dirname(__FILE__) . '/includes/lib_integral.php';
    $is_got_integral = is_got_information_completed_integral($user_id);
    if ($is_got_integral == 0) {
        $completed_percent = user_information_completed_percent($user_id);
        if ($completed_percent >= 80.0) {
            user_get_point($_CFG['register_points'], $user_id, 3, '完善资料获得积分', 0);
        }
    }
    if ($a) {
        show_message($_LANG['edit_profile_success'], $_LANG['profile_lnk'], 'user.php?act=profile', 'info');
    } else {
        if ($user->error == ERR_EMAIL_EXISTS) {
            $msg = sprintf($_LANG['email_exist'], $profile['email']);
        } else {
            $msg = $_LANG['edit_profile_failed'];
        }
        show_message($msg, '', '', 'info');
    }
} elseif ($action == 'get_password') {
    include_once ROOT_PATH . 'includes/lib_passport.php';
    $smarty->assign('script_name', 'qpassword');
예제 #4
0
/**
 * 用户签到函数 chen-0909
 *
 * @param   user_id gained_integral   用户的id,和签到获得积分
 *
 * @return  bool  签到是否成功
 */
function user_attent($user_id, $gained_integral)
{
    $type = 5;
    //类型5:表示每日签到获取的积分
    $detail = "每日签到获得{$gained_integral}";
    $is_frozen = 0;
    $sql = " select id,last_attent_time,continuity_times from " . $GLOBALS['ecs']->table('daily_attendance') . " where user_id={$user_id} order by last_attent_time desc";
    $row = $GLOBALS['db']->getRow($sql);
    $now = gmtime();
    $date = local_date('Y-m-d 0:0:0', $now);
    $now = local_strtotime($date);
    if (!$row || $now - $row['last_attent_time'] > 60 * 60 * 24) {
        user_get_point($gained_integral, $user_id, $type, $detail, $is_frozen);
        $sql = "insert into " . $GLOBALS['ecs']->table('daily_attendance') . "(user_id,integral,last_attent_time,continuity_times) values({$user_id},{$gained_integral},{$now},1)";
        $GLOBALS['db']->query($sql);
    } else {
        if ($now - $row['last_attent_time'] == 60 * 60 * 24) {
            user_get_point($gained_integral, $user_id, $type, $detail, $is_frozen);
            $continuity_times = $row['continuity_times'] + 1;
            $sql = "insert into " . $GLOBALS['ecs']->table('daily_attendance') . "(user_id,integral,last_attent_time,continuity_times) values({$user_id},{$gained_integral},{$now},{$continuity_times})";
            $GLOBALS['db']->query($sql);
        } else {
            return 0;
        }
    }
    return 1;
}