Example #1
0
$code = empty($_GET['code']) ? '' : $_GET['code'];
$app = empty($_GET['app']) ? '' : intval($_GET['app']);
$invite = empty($_GET['invite']) ? '' : $_GET['invite'];
$invitearr = array();
$reward = getreward('invitecode', 0);
if ($uid && $code && !$reward['credit']) {
    $m_space = getspace($uid);
    if ($code == space_key($m_space, $app)) {
        //验证通过
        $invitearr['uid'] = $uid;
        $invitearr['username'] = $m_space['username'];
    }
    $url_plus = "uid={$uid}&app={$app}&code={$code}";
} elseif ($uid && $invite) {
    include_once S_ROOT . './source/function_cp.php';
    $invitearr = invite_get($uid, $invite);
    $url_plus = "uid={$uid}&invite={$invite}";
}
if ($_SCONFIG['seccode_login']) {
    include_once S_ROOT . './source/function_cp.php';
    if (!ckseccode($_POST['seccode'])) {
        $_SGLOBAL['input_seccode'] = 1;
        include template('do_login');
        exit;
    }
}
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('member') . " WHERE username='******'");
$value = $_SGLOBAL['db']->fetch_array($query);
if (empty($value)) {
    showmessage('login_failure_please_re_login', 'do.php?ac=' . $_SCONFIG['login_action']);
}
Example #2
0
function eycp_register_to_ucenter($openid, $login, $email, $nickname)
{
    /////////////////////////////////////
    //好友邀请数据预处理
    include_once S_ROOT . './source/function_cp.php';
    $uid = empty($_GET['uid']) ? 0 : intval($_GET['uid']);
    $code = empty($_GET['code']) ? '' : $_GET['code'];
    $app = empty($_GET['app']) ? '' : intval($_GET['app']);
    $invite = empty($_GET['invite']) ? '' : $_GET['invite'];
    $invitearr = array();
    $reward = getreward('invitecode', 0);
    $pay = $app ? 0 : $reward['credit'];
    if ($uid && $code && !$pay) {
        //邀请玩应用home就不给奖励了?
        $m_space = getspace($uid);
        //$_SN在此被赋值
        // echo var_dump($_SN)."--_SN在getspace这个函数中赋值了...<br>";
        // echo var_dump($_SESSION['SN'])."--_SESSION['SN']<br>";
        // echo var_dump($m_space['uid'])."--m_space['uid']<br>";
        // echo var_dump($app)."--app<br>";
        // echo var_dump($code)."--code<br>";
        // echo var_dump($_SCONFIG['sitekey']).'--sitekey<br>';
        // echo space_key($m_space, $app)."--space_key<br>";
        if ($code == space_key($m_space, $app)) {
            //验证通过
            $invitearr['uid'] = $uid;
            $invitearr['username'] = $m_space['username'];
        }
        $url_plus = "uid={$uid}&app={$app}&code={$code}";
        // echo var_dump($uid)."--uid<br>";
        // echo var_dump($m_space['username'])."--m_space['username']<br>";
        // echo var_dump($invitearr)."--_invitearr1<br>";
        // echo var_dump($url_plus)."--url_plus1<br>";
    } elseif ($uid && $invite) {
        include_once S_ROOT . './source/function_cp.php';
        $invitearr = invite_get($uid, $invite);
        $url_plus = "uid={$uid}&invite={$invite}";
        // echo var_dump($invitearr)."--_invitearr2<br>";
    }
    $jumpurl = $app ? "userapp.php?id={$app}&my_extra=invitedby_bi_{$uid}_{$code}&my_suffix=Lw%3D%3D" : 'space.php?do=home';
    //好友邀请数据预处理结束
    /////////////////////////////////////
    /////////////////////////////////////
    //注册到ucenter
    // 不采用uhome及ucenter自己的登录机制,所以随机填个它的密码
    $password = md5("{$newuid}|{$_SGLOBAL['timestamp']}");
    //本地密码随机生成
    //用ucenter api注册新用户
    include S_ROOT . './uc_client/client.php';
    $newuid = uc_user_register($login, $password, $email);
    // echo var_dump($newuid)."--newuid<br/>";
    // breakpoint();
    if ($newuid <= 0) {
        if ($newuid == -1) {
            showmessage('user_name_is_not_legitimate');
        } elseif ($newuid == -2) {
            showmessage('include_not_registered_words');
        } elseif ($newuid == -3) {
            // showmessage('user_name_already_exists');
            // 如果已经在ucenter存在先通过discuz注册的用户,则为他开通uchome
            //同步获取用户源
            if (!($passport = get_passport_by_login($login))) {
                showmessage('login_failure_please_re_login', 'OpenID.call.php');
            }
            // echo var_dump($passport)."--passport<br/>";
            $setarr = array('uid' => $passport['uid'], 'username' => addslashes($passport['username']), 'password' => md5("{$passport['uid']}|{$_SGLOBAL['timestamp']}"));
            // echo var_dump($setarr)."--setarr<br/>";
            // echo var_dump($email)."--email<br/>";
            ey_regiter_user_to_uchome($setarr, $openid, $login, $email, $nickname, $invitearr, $url_plus, $app, $jumpurl);
        } elseif ($newuid == -4) {
            showmessage('email_format_is_wrong');
        } elseif ($newuid == -5) {
            showmessage('email_not_registered');
        } elseif ($newuid == -6) {
            showmessage('email_has_been_registered');
        } else {
            showmessage('register_error');
        }
    } else {
        $setarr = array('uid' => $newuid, 'username' => $login, 'password' => md5("{$newuid}|{$_SGLOBAL['timestamp']}"));
        ey_regiter_user_to_uchome($setarr, $openid, $login, $email, $nickname, $invitearr, $url_plus, $app, $jumpurl);
    }
}