Пример #1
0
             $result = mysql_query($d_db) or die('');
             $qq_a = $qq->get_user_info($q_a['openid']);
             $q_name = $qq_a['nickname'];
             if ($r_dby['s_n'] != $qq_name || $r_dby['s_id'] != $q_a['openid']) {
                 $u_db = sprintf('update %s set s_n=%s, s_id=%s where id=%s', $dbprefix . 'm_sync', SQLString($qq_name, 'text'), SQLString($q_a['openid'], 'text'), $r_dby['id']);
                 $result = mysql_query($u_db) or die('');
             }
             $content .= '当前已绑定QQ账号<table width="200"><tr><td align="center">' . ($qq_a['figureurl_1'] != '' ? '<img src="' . $qq_a['figureurl_1'] . '" alt=""/><br/>' : '') . $q_name . '(<a href="?m=profile&amp;t=sync&amp;n=' . $nct . '&amp;lt=1">取消绑定</a>)</td></tr></table>';
         } else {
             $d_db = sprintf('delete from %s where aid=%s and name=%s', $dbprefix . 'm_sync', $r_dbu['id'], SQLString($nct, 'text'));
             $result = mysql_query($d_db) or die('');
         }
     }
     mysql_free_result($q_dby);
     if ($is_sync == 0) {
         $qq = new qqPHP($config['qq_app_id'], $config['qq_app_key']);
         $qurl = $qq->login_url($config['site_url'] . 'qq_callback.php');
         $content .= '<a href="' . $qurl . '">点击此处和您的QQ账号建立连接</a>';
     }
     $content .= '<br/><br/>绑定QQ账号后将实现以下功能:<ol><li>使用QQ账号登录</li><li>注:QQ账号不可以重复绑定,用户绑定后,其他用户绑定的同一QQ账号将自动解除绑定</li></ol>';
     break;
 case 'kx001':
     if (isset($_GET['lt']) && $_GET['lt'] == 1) {
         $d_db = sprintf('delete from %s where aid=%s and name=%s', $dbprefix . 'm_sync', $r_dbu['id'], SQLString($nct, 'text'));
         $result = mysql_query($d_db) or die('');
         header('Location:./?m=profile&t=sync&n=' . $nct);
         exit;
     }
     require_once 'lib/kaixin.php';
     $is_sync = 0;
     $s_dby = sprintf('select id, s_id, s_t, s_r, s_n, edate, is_show from %s where aid=%s and name=%s limit 1', $dbprefix . 'm_sync', $r_dbu['id'], SQLString($nct, 'text'));
Пример #2
0
    echo $loginoutjs;
    echo "<script>window.location.href='" . $GLOBALS['cfg_basehost'] . "'</script>";
    //header("location:{$GLOBALS['cfg_basehost']}".$loginoutjs);
    exit;
}
//通过QQ登陆
if ($dopost == 'loginbyqq') {
    session_start();
    $code = $_REQUEST["code"];
    include SLINEINC . '/qq.class.php';
    //$appid='100423525';
    //$appkey='f833e7f02293ff05dfeb303d71fdf255';
    $appid = $cfg_qq_appid;
    $appkey = $cfg_qq_appkey;
    $callback_url = "{$GLOBALS['cfg_basehost']}/member/login.php?dopost=loginbyqq";
    $qq = new qqPHP($appid, $appkey, $callback_url);
    if (empty($code)) {
        $url = $qq->login_url($_SESSION['state']);
        header("location:{$url}");
        exit;
    } else {
        $token = $qq->access_token($code);
        //获取access-toking
        $openid = $qq->get_openid($token);
        //获取openid
        if (!empty($openid)) {
            $sql = "select * from #@__member where `connectid`='{$openid}' and `from`='qq'";
            $r = $dsql->GetOne($sql);
            if (!empty($r)) {
                /* $user=!empty($r['mobile']) ?  $r['mobile'] : $r['email'];
                				 $pass=$r['pwd'];
Пример #3
0
 * 请勿出售本程序或其修改版,请勿利用本程序或其修改版进行任何商业活动。
 */
session_start();
require_once 'config.php';
require_once 'function.php';
$u = './';
$c_log = chklog();
if ($c_log) {
    $u = './?m=profile&t=sync&n=qq';
} else {
    $u = './?m=login&t=qq';
}
if ($config['is_qq'] > 0 && $config['qq_app_id'] != '' && $config['qq_app_key'] != '') {
    if (isset($_GET['code']) && trim($_GET['code']) != '') {
        require_once 'lib/qq.php';
        $o = new qqPHP($config['qq_app_id'], $config['qq_app_key']);
        $result = $o->access_token($config['site_url'] . 'qq_callback.php', $_GET['code']);
    }
    if (isset($result['access_token']) && $result['access_token'] != '') {
        $s_t = $result['access_token'];
        if ($c_log) {
            $ar = getainfo($_SESSION[$config['u_hash']], 'id, name');
            $s_dby = sprintf('select id from %s where aid=%s and name=%s limit 1', $dbprefix . 'm_sync', $ar['id'], SQLString('qq', 'text'));
            $q_dby = mysql_query($s_dby) or die('');
            $r_dby = mysql_fetch_assoc($q_dby);
            if (mysql_num_rows($q_dby) > 0) {
                $u_db = sprintf('update %s set s_t=%s where id=%s', $dbprefix . 'm_sync', SQLString($s_t, 'text'), $r_dby['id']);
                $result = mysql_query($u_db) or die('');
            } else {
                $i_db = sprintf('insert into %s (aid, name, s_t) values (%s, %s, %s)', $dbprefix . 'm_sync', $ar['id'], SQLString('qq', 'text'), SQLString($s_t, 'text'));
                $result = mysql_query($i_db) or die('');