Beispiel #1
0
}
$selfurl = $_G['siteurl'] . 'plugin.php?id=wechat&mobile=2&key=' . $keyenc . ($_GET['referer'] ? '&referer=' . urlencode($_GET['referer']) : '') . ($_GET['username'] ? '&username='******'username']) : '') . '&ac=';
if (!$_G['wechat']['setting']['wechat_qrtype'] && IN_WECHAT && !$openid) {
    if ($_G['wechat']['setting']['wechat_mtype'] != 2) {
        if (!empty($_G['cookie']['wechatopenid'])) {
            $openid = authcode($_G['cookie']['wechatopenid'], 'DECODE', $_G['config']['security']['authkey']);
        }
        if (!$openid) {
            showmessage('wechat:wechat_undefined');
        }
    } else {
        $wechat_client = new WeChatClient($_G['wechat']['setting']['wechat_appId'], $_G['wechat']['setting']['wechat_appsecret']);
        $openid = !empty($_G['cookie']['wechatopenid']) ? authcode($_G['cookie']['wechatopenid'], 'DECODE', $_G['config']['security']['authkey']) : '';
        if (!$openid) {
            if (empty($_GET['oauth'])) {
                $redirect_uri = $wechat_client->getOauthConnectUri($selfurl . $ac . '&oauth=yes');
                dheader('location: ' . $redirect_uri);
            } else {
                $tockeninfo = $wechat_client->getAccessTokenByCode($_GET['code']);
                $openid = $tockeninfo['openid'];
                dsetcookie('wechatopenid', authcode($openid, 'ENCODE', $_G['config']['security']['authkey']), 86400);
            }
        }
    }
} elseif ($openid) {
    dsetcookie('wechatopenid', authcode($openid, 'ENCODE', $_G['config']['security']['authkey']), 86400);
}
wsq::report('loginevent');
require_once libfile('function/member');
if ($openid) {
    if ($ac == 'qqbind') {