*/ session_start(); require_once 'config.php'; require_once 'function.php'; $c_log = chklog(); if ($c_log) { $id = isset($_GET['i']) && intval($_GET['i']) ? intval($_GET['i']) : $_SESSION[$config['u_hash']]; switch ($_GET['t']) { case 'sina': if ($config['is_sina'] > 0 && $config['sina_key'] != '' && $config['sina_se'] != '') { $s_dby = sprintf('select s_id, s_t from %s where aid=%s and name=%s and is_show=0 limit 1', $dbprefix . 'm_sync', $id, SQLString('sina', 'text')); $q_dby = mysql_query($s_dby) or die(''); $r_dby = mysql_fetch_assoc($q_dby); if (mysql_num_rows($q_dby) > 0) { require_once 'lib/sina.php'; $so = new sinaPHP($config['sina_key'], $config['sina_se'], $r_dby['s_t']); $ma = $so->user_timeline($r_dby['s_id'], 5); if (!isset($ma['error_code']) && is_array($ma['statuses']) && count($ma['statuses']) > 0) { foreach ($ma['statuses'] as $v) { if (trim($v['text']) != '') { echo '<div class="sync_list" style="background-image: url(images/i-sina.gif);">' . trim($v['text']) . '</div>'; } } } } mysql_free_result($q_dby); } break; case 'tqq': if ($config['is_tqq'] > 0 && ($config['is_utqq'] > 0 || $config['tqq_key'] != '' && $config['tqq_se'] != '')) { $s_dby = sprintf('select s_id, s_t from %s where aid=%s and name=%s and is_show=0 limit 1', $dbprefix . 'm_sync', $id, SQLString('tqq', 'text'));
exit; } } } } //通过新浪微博登陆 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);
} while ($r_dbr = mysql_fetch_assoc($q_dbr)); } mysql_free_result($q_dbr); } if (isset($a)) { $aid = $_SESSION[$config['u_hash']]; $u_db = sprintf('update %s set sync_p=%s where id=%s', $dbprefix . $a[0][3], SQLString('', 'text'), $a[0][2]); $result = mysql_query($u_db) or die(''); $am = explode('|', $a[0][1]); if ($config['is_sina'] > 0 && $config['sina_key'] != '' && $config['sina_se'] != '' && in_array('sina', $am)) { $s_dby = sprintf('select s_t from %s where aid=%s and name=%s limit 1', $dbprefix . 'm_sync', $aid, SQLString('sina', 'text')); $q_dby = mysql_query($s_dby) or die(''); $r_dby = mysql_fetch_assoc($q_dby); if (mysql_num_rows($q_dby) > 0) { require_once 'lib/sina.php'; $sina = new sinaPHP($config['sina_key'], $config['sina_se'], $r_dby['s_t']); $sina->update($a[0][0]); } mysql_free_result($q_dby); } if ($config['is_tqq'] > 0 && ($config['is_utqq'] > 0 || $config['tqq_key'] != '' && $config['tqq_se'] != '') && in_array('tqq', $am)) { $s_dby = sprintf('select s_id, s_t from %s where aid=%s and name=%s limit 1', $dbprefix . 'm_sync', $aid, SQLString('tqq', 'text')); $q_dby = mysql_query($s_dby) or die(''); $r_dby = mysql_fetch_assoc($q_dby); if (mysql_num_rows($q_dby) > 0) { require_once 'lib/tqq.php'; $tqq = new tqqPHP($config['tqq_key'], $config['tqq_se'], $r_dby['s_t'], $r_dby['s_id']); $tqq->postOne($a[0][0]); } mysql_free_result($q_dby); }
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&t=sync&n=' . $nct . '&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&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'));
* 请勿出售本程序或其修改版,请勿利用本程序或其修改版进行任何商业活动。 */ session_start(); require_once 'config.php'; require_once 'function.php'; $u = './'; $c_log = chklog(); if ($c_log) { $u = './?m=profile&t=sync&n=sina'; } else { $u = './?m=login&t=sina'; } if ($config['is_sina'] > 0 && $config['sina_key'] != '' && $config['sina_se'] != '') { if (isset($_GET['code']) && trim($_GET['code']) != '') { require_once 'lib/sina.php'; $o = new sinaPHP($config['sina_key'], $config['sina_se']); $result = $o->access_token($config['site_url'] . 'sina_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('sina', '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('sina', 'text'), SQLString($s_t, 'text')); $result = mysql_query($i_db) or die('');