$content .= '<br/><br/>绑定新浪微博账号后将实现以下功能:<ol><li>将留言、评论、回复发布到新浪微博</li><li>在<a href="?m=user&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(''); $r_dby = mysql_fetch_assoc($q_dby); if (mysql_num_rows($q_dby) > 0) { $qq = qqPHP($config['qq_app_id'], $config['qq_app_key'], $r_dby['s_t']); $q_a = $qq->get_openid(); if (isset($q_a['openid']) && $q_a['openid'] != '') { $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(''); $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&t=sync&n=' . $nct . '&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('');
exit; } else { $_SESSION['sina_login_u_t'] = ''; } } if (!isset($_SESSION['sina_login_u_t']) || $_SESSION['sina_login_u_t'] == '') { $so = new sinaPHP($config['sina_key'], $config['sina_se']); $aurl = $so->login_url($config['site_url'] . 'sina_callback.php'); header('Location:' . $aurl); exit; } break; case 'qq': require_once 'lib/qq.php'; if (isset($_SESSION['qq_login_u_t']) && $_SESSION['qq_login_u_t'] != '') { $qq = qqPHP($config['qq_app_id'], $config['qq_app_key'], $_SESSION['qq_login_u_t']); $q_a = $qq->get_openid(); if (isset($q_a['openid']) && $q_a['openid'] != '') { if (isset($_SESSION[$config['u_hash'] . '_m']) && $_SESSION[$config['u_hash'] . '_m'] == 1) { $goto = 'm/'; $_SESSION[$config['u_hash'] . '_m'] = ''; unset($_SESSION[$config['u_hash'] . '_m']); } $s_dbu = sprintf('select a.id, a.username, a.password, a.sylorm, b.s_t, b.id as bid from %s as a, %s as b where a.id=b.aid and b.s_id=%s and b.name=%s%s limit 1', $dbprefix . 'member', $dbprefix . 'm_sync', SQLString($q_a['openid'], 'text'), SQLString($nct, 'text'), $vdb); $q_dbu = mysql_query($s_dbu) or die(''); $r_dbu = mysql_fetch_assoc($q_dbu); if (mysql_num_rows($q_dbu) > 0) { if ($r_dbu['s_t'] != $_SESSION['qq_login_u_t']) { $u_db = sprintf('update %s set s_t=%s where id=%s', $dbprefix . 'm_sync', SQLString($_SESSION['qq_login_u_t'], 'text'), $r_dbu['bid']); $result = mysql_query($u_db) or die(''); }