switch ($nct) { case 'facebook': 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/facebook.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 facebookPHP($config['fb_app_id'], $config['fb_se'], $r_dby['s_t']); $ma = $so->me(); if (isset($ma['id']) && $ma['id'] != '') { $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['id'], 'text')); $result = mysql_query($d_db) or die(''); $me_url = $ma['link']; if ($r_dby['s_n'] != $me_url || $r_dby['s_id'] != $ma['id']) { $u_db = sprintf('update %s set s_n=%s, s_id=%s where id=%s', $dbprefix . 'm_sync', SQLString($me_url, 'text'), SQLString($ma['id'], 'text'), $r_dby['id']); $result = mysql_query($u_db) or die(''); } $content .= '当前已绑定Facebook账号<table width="200"><tr><td align="center"><img src="https://graph.facebook.com/' . $ma['username'] . '/picture" alt=""/><br/><a href="' . $me_url . '" target="_blank">' . $ma['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"' : '') . '/>隐藏已绑定Facebook账号相关信息<br/><input type="submit" value="更新" class="button"/><input type="hidden" name="isl_fb_h" value="' . $r_dby['id'] . '"/></form>'; } else { $so = new facebookPHP($config['fb_app_id'], $config['fb_se']); $aurl = $so->login_url($config['site_url'] . 'facebook_callback.php', 'user_about_me'); header('Location:' . $aurl);
if ($nct != '') { if (isset($_SESSION['login_sync_tn']) && $_SESSION['login_sync_tn'] != '' && isset($a_sync[$_SESSION['login_sync_tn']])) { $_SESSION['login_sync_tn'] = ''; $_SESSION['login_sync_id'] = ''; $_SESSION['login_sync_t'] = ''; $_SESSION['login_sync_r'] = ''; $_SESSION['login_sync_s'] = ''; $_SESSION['login_sync_u'] = ''; $_SESSION['login_sync_edate'] = 0; } } switch ($nct) { case 'facebook': require_once 'lib/facebook.php'; $fb = new facebookPHP($config['fb_app_id'], $config['fb_se'], $_SESSION['facebook_login_u_t']); $fb_me = $fb->me(); if (isset($fb_me['id']) && $fb_me['id'] != '') { 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($fb_me['id'], '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['facebook_login_u_t']) { $u_db = sprintf('update %s set s_t=%s where id=%s', $dbprefix . 'm_sync', SQLString($_SESSION['facebook_login_u_t'], 'text'), $r_dbu['bid']); $result = mysql_query($u_db) or die(''); } $u_db = sprintf('update %s set visit=visit+1, visitdate=%s where id=%s', $dbprefix . 'member', time(), $r_dbu['id']);