예제 #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 livePHP($config['live_key'], $config['live_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('');
     }
     $ms_o = new livePHP($config['live_key'], $config['live_se'], $r_dby['s_t']);
     $ms_a = $ms_o->me();
     if (isset($ms_a['id']) && $ms_a['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($ms_a['id'], 'text'));
         $result = mysql_query($d_db) or die('');
         if ($r_dby['s_id'] != $ms_a['id']) {
             $u_db = sprintf('update %s set s_id=%s where id=%s', $dbprefix . 'm_sync', SQLString($ms_a['id'], 'text'), $r_dby['id']);
             $result = mysql_query($u_db) or die('');
         }
         $content .= '当前已绑定Microsoft账户<table width="200"><tr><td align="center"><img src="https://apis.live.net/v5.0/me/picture?access_token=' . $r_dby['s_t'] . '" alt=""/><br/>' . $ms_a['name'] . '(<a href="?m=profile&amp;t=sync&amp;n=' . $nct . '&amp;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('');
     }
 }
 mysql_free_result($q_dby);
예제 #2
0
             $_SESSION['google_login_u_r'] = '';
             $_SESSION['google_login_u_edate'] = 0;
         }
     }
     if (!isset($_SESSION['google_login_u_t']) || $_SESSION['google_login_u_t'] == '') {
         $gg_o = new googlePHP($config['google_key'], $config['google_se']);
         $aurl = $gg_o->login_url($config['site_url'] . 'google_callback.php', 'https://www.googleapis.com/auth/userinfo.profile');
         header('Location:' . $aurl);
         exit;
     }
     break;
 case 'live':
     require_once 'lib/live.php';
     if (isset($_SESSION['live_login_u_t']) && $_SESSION['live_login_u_t'] != '') {
         $ms_o = new livePHP($config['live_key'], $config['live_se'], $_SESSION['live_login_u_t']);
         $me = $ms_o->me();
         if (isset($me['id']) && $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($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['live_login_u_t']) {
                     $u_db = sprintf('update %s set s_t=%s, s_r=%s, edate=%s where id=%s', $dbprefix . 'm_sync', SQLString($_SESSION['live_login_u_t'], 'text'), SQLString($_SESSION['live_login_u_r'], 'text'), SQLString($_SESSION['live_login_u_edate'], 'int'), $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']);