コード例 #1
0
ファイル: login.php プロジェクト: lz1988/stourwebcms
        }
    }
}
//通过新浪微博登陆
if ($dopost == 'loginbysina') {
    session_start();
    $code = $_REQUEST["code"];
    include SLINEINC . '/sina.class.php';
    //$appkey='2329402441';
    //$appsecert='efe3721090316b79c83683ad6e5308ec';
    $appkey = $cfg_sina_appkey;
    $appsecret = $cfg_sina_appsecret;
    $callback_url = "{$GLOBALS['cfg_basehost']}/member/login.php?dopost=loginbysina";
    $sina = new sinaPHP($appkey, $appsecret, $callback_url);
    if (empty($code)) {
        $url = $sina->login_url();
        header("location:{$url}");
        exit;
    } else {
        $ar = $sina->access_token($code);
        //获取access-toking
        $sina->access_token = $ar['access_token'];
        //
        $me = $sina->get_uid();
        $uid = $me['uid'];
        $me = $sina->show_user_by_id($uid);
        if (!empty($me['id'])) {
            $sql = "select * from #@__member where `connectid`='{$me['id']}' and `from`='sina'";
            $r = $dsql->GetOne($sql);
            if (!empty($r)) {
                $user = !empty($r['mobile']) ? $r['mobile'] : $r['email'];
コード例 #2
0
ファイル: p_sync.php プロジェクト: lyhiving/mini_class
                 $u_db = sprintf('update %s set s_n=%s, s_id=%s where id=%s', $dbprefix . 'm_sync', SQLString($me_url, 'text'), SQLString($ma['uid'], 'text'), $r_dby['id']);
                 $result = mysql_query($u_db) or die('');
             }
             $content .= '当前已绑定新浪微博账号<table width="200"><tr><td align="center">' . ($sina_u['profile_image_url'] != '' ? '<img src="' . $sina_u['profile_image_url'] . '" alt=""/><br/>' : '') . '<a href="' . $me_url . '" target="_blank">' . $sina_u['name'] . '</a>(<a href="?m=profile&amp;t=sync&amp;n=' . $nct . '&amp;lt=1">取消绑定</a>)</td></tr></table>';
             $content .= '<br/><br/><form method="post" action=""><input type="checkbox" name="is_show" value="1"' . ($r_dby['is_show'] > 0 ? ' checked="checked"' : '') . '/>隐藏已绑定新浪微博账号相关信息<br/><input type="submit" value="更新" class="button"/><input type="hidden" name="isl_sina_h" value="' . $r_dby['id'] . '"/></form>';
         } else {
             $so = new sinaPHP($config['sina_key'], $config['sina_se']);
             $aurl = $so->login_url($config['site_url'] . 'sina_callback.php');
             header('Location:' . $aurl);
             exit;
         }
     }
     mysql_free_result($q_dby);
     if ($is_sync == 0) {
         $so = new sinaPHP($config['sina_key'], $config['sina_se']);
         $aurl = $so->login_url($config['site_url'] . 'sina_callback.php');
         $content .= '<a href="' . $aurl . '">点击此处和您的新浪微博账号建立连接</a>';
     }
     $content .= '<br/><br/>绑定新浪微博账号后将实现以下功能:<ol><li>将留言、评论、回复发布到新浪微博</li><li>在<a href="?m=user&amp;id=' . $r_dbu['id'] . '">用户信息</a>页面显示最新的新浪微博留言</li><li>使用新浪微博账号登录</li><li>注:新浪微博账号不可以重复绑定,用户绑定后,其他用户绑定的同一新浪微博账号将自动解除绑定</li></ol>';
     break;
 case 'qq':
     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/qq.php';
     $is_sync = 0;
     $s_dby = sprintf('select id, s_id, s_t, s_n 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('');