case 'kx001': 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/kaixin.php'; $is_sync = 0; $s_dby = sprintf('select id, s_id, s_t, s_r, s_n, edate, 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) { if ($r_dby['edate'] < time() && $r_dby['edate'] > 0 && $r_dby['s_r'] != '') { $o = new kaixinPHP($config['kx001_key'], $config['kx001_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(''); } $kx_co = new kaixinPHP($config['kx001_key'], $config['kx001_se'], $r_dby['s_t']); $kx_re = $kx_co->me(); if (isset($kx_re['uid']) && $kx_re['uid'] != '' && !isset($kx_re['error_code'])) { $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($kx_re['uid'], 'text')); $result = mysql_query($d_db) or die(''); $me_url = 'http://www.kaixin001.com/home/?uid=' . $kx_re['uid'];