Esempio n. 1
0
        showmessage('qqconnect:connect_config_unbind_success', 'member.php?mod=logging&action=login');
    }
} else {
    if ($_G[inajax] && $op == 'synconfig') {
        DB::query("UPDATE " . DB::table('common_member_connect') . " SET conispublishfeed='0', conispublisht='0' WHERE uid='{$_G['uid']}'");
        dsetcookie('connect_synpost_tip');
    } elseif ($op == 'weibosign') {
        require_once libfile('function/connect');
        connect_merge_member();
        if ($_G['member']['conuin'] && $_G['member']['conuinsecret']) {
            $arr = array();
            $arr['oauth_consumer_key'] = $_G['setting']['connectappid'];
            $arr['oauth_nonce'] = mt_rand();
            $arr['oauth_timestamp'] = TIMESTAMP;
            $arr['oauth_signature_method'] = 'HMAC_SHA1';
            $arr['oauth_token'] = $_G['member']['conuin'];
            ksort($arr);
            $arr['oauth_signature'] = connect_get_oauth_signature('http://api.discuz.qq.com/connect/getSignature', $arr, 'GET', $_G['member']['conuinsecret']);
            $result = connect_output_php('http://api.discuz.qq.com/connect/getSignature?' . cloud_http_build_query($arr, '', '&'));
            if ($result['status'] == 0) {
                connect_ajax_ouput_message('[wb=' . $result['result']['username'] . ']' . $result['result']['signature_url'] . '[/wb]', 0);
            } else {
                connect_ajax_ouput_message('connect_wbsign_no_account', $result['status']);
            }
        } else {
            connect_ajax_ouput_message('connect_wbsign_no_bind', -1);
        }
    } else {
        dheader('location: home.php?mod=spacecp&ac=plugin&id=qqconnect:spacecp');
    }
}
<?php

/**
 *	  [Discuz!] (C)2001-2009 Comsenz Inc.
 *	  This is NOT a freeware, use is subject to license terms
 *
 *	  $Id: connect_check.php 27643 2012-02-08 11:20:46Z zhouxiaobo $
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
require_once libfile('function/connect');
require_once libfile('function/cloud');
$op = !empty($_G['gp_op']) ? $_G['gp_op'] : '';
if (!in_array($op, array('cookie'))) {
    connect_ajax_ouput_message('0', '1');
}
if ($op == 'cookie') {
    $settings = array();
    $query = DB::query("SELECT skey, svalue FROM " . DB::table('common_setting') . " WHERE skey IN ('connect_login_times', 'connect_login_report_date')");
    while ($setting = DB::fetch($query)) {
        $settings[$setting['skey']] = $setting['svalue'];
    }
    if ($settings['connect_login_times'] && (empty($settings['connect_login_report_date']) || dgmdate(TIMESTAMP, 'Y-m-d') != $settings['connect_login_report_date'])) {
        if (!discuz_process::islocked('connect_login_report', 600)) {
            $result = connect_cookie_login_report($settings['connect_login_times']);
            if (isset($result['status']) && $result['status'] == 0) {
                DB::query("REPLACE INTO " . DB::table('common_setting') . " (`skey`, `svalue`)\n\t\t\t\tVALUES ('connect_login_times', '0'), ('connect_login_report_date', '" . dgmdate(TIMESTAMP, 'Y-m-d') . "')");
            }
        }
        discuz_process::unlock('connect_login_report');
Esempio n. 3
0
    if ($_G['setting']['connect']['allow'] && !$_G['cookie']['connect_check_token'] && $_G['member']['conuinsecret']) {
        dsetcookie('connect_check_token', '1', 14400);
        $api_url = $_G['connect']['api_url'] . '/connect/discuz/validateToken';
        $extra = array('oauth_token' => $_G['member']['conuin']);
        $sig_params = connect_get_oauth_signature_params($extra);
        $oauth_token_secret = $_G['member']['conuinsecret'];
        $sig_params['oauth_signature'] = connect_get_oauth_signature($api_url, $sig_params, 'POST', $oauth_token_secret);
        $params = array('client_ip' => $_G['clientip'], 'response_type' => 'PHP');
        $params = array_merge($sig_params, $params);
        $response = connect_output_php($api_url . '?', cloud_http_build_query($params, '', '&'));
        if (isset($response['status']) && ($response['status'] === 2024 || $response['status'] === 2025)) {
            DB::query('UPDATE ' . DB::table('common_member_connect') . " SET conuinsecret='' WHERE conopenid='" . $_G['member']['conopenid'] . "'");
            connect_ajax_ouput_message('2', 'token_outofdate', 0);
        }
    }
    connect_ajax_ouput_message('', 'token_not_outofdate', 2);
} elseif ($op == 'cookie') {
    $now = time();
    $life = 86400;
    $response = '';
    $api_url = $_G['connect']['api_url'] . '/connect/discuz/cookieReport';
    $params = connect_cookie_login_params();
    if ($params) {
        $last_report_time = getcookie('connect_last_report_time');
        $current_date = date('Y-m-d');
        if (getcookie('connect_report_times')) {
            $retry = intval(getcookie('connect_report_times'));
        } else {
            $retry = 1;
        }
        if ($last_report_time == $current_date) {