예제 #1
0
 //$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'];
             $user = empty($user) ? $r['mid'] : $user;
             $pass = $r['pwd'];
             $User = new Member(7 * 3600);
             $flag = $User->login($user, $pass, true);
             if ($flag) {
                 $url = "{$GLOBALS['cfg_basehost']}/member";
                 header("Location:{$url}");
                 exit;
예제 #2
0
     break;
 case 'sina':
     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/sina.php';
     $is_sync = 0;
     $s_dby = sprintf('select id, s_id, s_t, s_n, 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('');
     $r_dby = mysql_fetch_assoc($q_dby);
     if (mysql_num_rows($q_dby) > 0) {
         $so = new sinaPHP($config['sina_key'], $config['sina_se'], $r_dby['s_t']);
         $ma = $so->get_uid();
         if (isset($ma['uid']) && !isset($ma['error'])) {
             $is_sync = 1;
             $d_db = sprintf('delete from %s where aid<>%s and name=%s and s_id=%s', $dbprefix . 'm_sync', $r_dbu['id'], SQLString($nct, 'text'), SQLString($ma['uid'], 'text'));
             $result = mysql_query($d_db) or die('');
             $sina_u = $so->show_user_by_id($ma['uid']);
             $me_url = 'http://weibo.com/' . (isset($sina_u['domain']) && $sina_u['domain'] != '' ? $sina_u['domain'] : $ma['uid']);
             if ($r_dby['s_n'] != $me_url || $r_dby['s_id'] != $ma['uid']) {
                 $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');