Exemple #1
0
 $q_dby = mysql_query($s_dby) or die('');
 $r_dby = mysql_fetch_assoc($q_dby);
 if (mysql_num_rows($q_dby) > 0) {
     if ($r_dby['edate'] < time() && $r_dby['edate'] > 0 && $r_dby['s_r'] != '') {
         $o = new t163PHP($config['t163_key'], $config['t163_se']);
         $result = $o->access_token_refresh($r_dby['s_r']);
         if (isset($result['access_token']) && $result['access_token'] != '') {
             $r_dby['s_t'] = $result['access_token'];
             $r_dby['s_r'] = $result['refresh_token'];
             $r_dby['edate'] = time() + $result['expires_in'];
         }
         $u_db = sprintf('update %s set s_t=%s, s_r=%s, edate=%s, mdate=%s where id=%s', $dbprefix . 'm_sync', SQLString($r_dby['s_t'], 'text'), SQLString($r_dby['s_r'], 'text'), SQLString($r_dby['edate'], 'int'), time(), $r_dby['id']);
         $result = mysql_query($u_db) or die('');
     }
     $tblog = new t163PHP($config['t163_key'], $config['t163_se'], $r_dby['s_t']);
     $me = $tblog->me();
     if (isset($me['id']) && $me['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($me['id'], 'text'));
         $result = mysql_query($d_db) or die('');
         $me_url = 'http://t.163.com/' . $me['screen_name'];
         if ($r_dby['s_n'] != $me_url || $r_dby['s_id'] != $me['id']) {
             $u_db = sprintf('update %s set s_n=%s, s_id=%s where id=%s', $dbprefix . 'm_sync', SQLString($me_url, 'text'), SQLString($me['id'], 'text'), $r_dby['id']);
             $result = mysql_query($u_db) or die('');
         }
         $content .= '当前已绑定网易微博账号<table width="200"><tr><td align="center">' . ($me['profile_image_url'] != '' ? '<img src="' . $me['profile_image_url'] . '" alt=""/><br/>' : '') . '<a href="' . $me_url . '" target="_blank">' . $me['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_t163_h" value="' . $r_dby['id'] . '"/></form>';
     } 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('');
     }