Exemplo n.º 1
0
    //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'];
                				 $User=new Member(7*3600);
                	             $flag = $User->Login($user, $pass,true);
Exemplo n.º 2
0
             $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'));
     $q_dby = mysql_query($s_dby) or die('');